Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Does not NILing a table cause data to stack up?

I've heard numerous stories about how data leaks could ruin performance in games, and I suspect a cause of this would be not niling tables after theyre used?

local function makeTbl()
	local tbl = {1, 2, 3}
end
for i = 1, 100 do
	makeTbl()
	wait(0.1)
end

Is this an example of a data leak?

1 answer

✓ Accepted answer

No. There are no references (it's not stored in a variable or used for anything) so the GC happily gobbles it up. That's no data leak and it won't cause any performance issues.

Anything stored in a variable can't be GC'd.

Leaks are usually the most severe when they're parts that have been destroyed. Just make sure you don't keep them around after destroying them. Keep them local to a function or set the variable to something else.

This discussion is preserved as it was. New answers, comments, and votes are closed.