This could be a sign of a memory leak. You could have forgotten to disconnect a few connections here and there or to set all references to a large table or Instance to nil. If you believe this is the case (you should probably check anyways), here’s a few resources you can refer to:
This article is meant to teach you how to prevent memory leaks and how the Roblox lua garbage collector works.
What is garbage collection?
Garbage collection, for those who are new to the term, is the process that a lot of languages such as JavaScript, python, and lua use to clean up memory. When values are no longer being used, they get garbage collected thus freeing up any memory they used.
What are memory leaks?
Memory leaks may sound like something scary. It might sound like it means inf…
Preface
I’ve seen several experienced developers not knowing this, or not having a full understanding of what’s going on, so I thought I’d write a dedicated post on the issue of accidentally leaking Instances (so that they are not GCed even when there are no references to them) through lingering event connections.
What circumstances cause a leak
do -- All good, this part will be GCed just fine
local p = Instance.new('Part')
p.Touched:connect(function() print("Touched") end)
end
do --…
1 Like