I’ve been playing around with the LuauHeap viewer in the dev console and I noticed that my settings menu even after being closed would make the number of thread go up by about 7.
But in my code, upon closing the gui, I clear and disconnect everything to prevent this from happening. Is this something normal that will just go away after a while or is this an issue in my code?.
Very strange… it didn’t clear these out after waiting for 5 minutes but I’ve boiled it down to the following: button.MouseEnter:Connect(function() end)
The thread seems to get created the first time the event fires and only goes away when the connection is disconnected. Its not only this specific event but all events in general.
I’ve read on another post that this is intended as every connection gets their own thread created.
This is how all signal connections work in Roblox. They are only garbage collected when the connection is disconnected. A clean way to handle the cleanup of connections, as well as signals if you create them is through Maids.
I was also wondering about re-assigning variables in something like Heartbeat etc. My scripts that employ these connections cause high fluctuation in memory usage due to assigning new values to variables and doing other tasks. Is there a specific way that can reduce this?