Posting this for a friend.
For some reason, the garbage collector seems to not collect items in specific scenarios. As an example, place the following script (named leakage) in StarterPlayerScripts and run the game:
local x = table.create(10000000, 'a')
task.wait(1)
I would expect for the garbage collector to collect and dispose of the table, but by taking a look at the memory view it appears to stay in memory forever.
This seems to only happen when the scope containing the data at hand is yielded for an arbitrary amount of time (around a second always works.) Removing the task.wait eliminates the issue, and surrounding the table.create in a do end
block eliminates the issue:
local x = table.create(10000000, 'a')
OR
do
local x = table.create(10000000, 'a')
end
task.wait(1)
There are other ways to cause this issue but this seems to be the most basic way. Any help would be appreciated as Iām really not sure as to what is causing this.