[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tables and the gc
- From: "Peter Hill" <corwin@...>
- Date: Sat, 26 Apr 2003 13:43:37 +0800
RLake:
> I suspect that there is more to your code than the example you gave. One
> thing to watch out for is local variables which might still refer to
> things; the mere fact that you are not using a local variable any more
> does not mean that it is still not on the stack, somewhere.
One thing I've been wondering about is the nature of closures, of which the
manual seems light on info. For example, consider:
do
local a, b = 0,"Local variable with gratuitous stuff in it."
function z()
a = a+1
end
end
The variable 'b' is no longer accessible so its contents should, ideally, be
garbage collected. Is it? Or is the local frame containing 'a' & 'b' held
onto because 'a' is still referenced?
*cheers*
Peter Hill