Memory leaks problem

Hello to all the guys who responded to this topic!
I’m having problems with a memory leak in roblox, I’ve already tried all the options, but to no avail.

image
Why is the garbage not cleaned? If you have an answer to this question, please share.

This might be because it takes time for the garbage collector to kick in and free up memory.

Possibly, but I can’t confirm it somehow.

Just so you’re aware, other scripts including core scripts will contribute to the size of the heap.

task.wait(15) --Wait for other scripts to initialize.
print(collectgarbage("count")) --1709
local Parts = {}
for _ = 1, 10000 do
	table.insert(Parts, Instance.new("Part"))
end
print(collectgarbage("count")) --2774
table.clear(Parts)
Parts = nil
task.wait(5) --Garbage collection isn't immediate.
print(collectgarbage("count")) --1510
1 Like