[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Minimising memory allocation
- From: David Lam <dlam@...>
- Date: Mon, 13 Aug 2001 11:43:10 +0100
Edgar Toernig wrote:
>No. Local variables are kept on a stack and will not effect the GC.
So any local string or table will be freed when you exit a function? That
sounds good.
> for i=1,100 do x="foo"..tostring(i) end -- 100 new strings
What about if x is a declare a local? Will only the last string assign to x
be free when the function exit? And the other 99 strings be GC?
Same questions goes for table: So if I have
function foo()
local x = {"a", "b", "c"}
x = {"d"}
end
{"d"} is free when the function exit and {"a", "b", "c"} will be GCed later?
David
-Virus scanned and cleared ok