Memory leak question

Let’s say I have a touched event on a part, each time I add a new part a new touched event is created for it, if I were to clone and destroy those parts several times, would the events they had connected to them be garbage collected automatically?

1 Like

Yes. Any connection to any event of a part you call :Destroy() on gets automatically disconnected and trashed

1 Like

What causes the leak is maintaining a reference to the part within the function you pass to the event Connect method.

See this thread for more details. PSA: Connections can memory leak Instances!

2 Likes