Will this cause a memory leak?

I have this table which I add new Instances to via join, a function that creates a new table with the two tables joined together (but does nothing to the old one). Could anyone explain to me if this causes any leaks?

	instanceTable = {Instance.new("Part")}
	instanceTable = join(instanceTable, Instance.new("Part"))

It shouldn’t cause any leaks. You’re just overwriting the table? The question you’re asking doesn’t necessarily make sense because why would it be used if it causes memory leaks.

1 Like

From what you mentioned, the original table will cease to have any references to it anymore, which the Luau GC will pick up on and eventually free up. So there should be no leak.

2 Likes

No, just wanted to make sure since I heard somewhere that Instances inside tables cause leaks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.