[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Re[6]: lua_closethread
- From: "Wim Couwenberg" <w.couwenberg@...>
- Date: Mon, 14 Jul 2003 13:02:26 +0200
> GC may collect any value which not referenced by some table (key or
> value).
That would be a bit harsh. GC collects objects that or *not reachable*
(directly or indirectly) from a root set. This root set is the C globals,
the registry and the stack. There are many more ways to reference an object
than through tables: closure environments, upvalues, thread globals, thread
stack, ...
As long as an object is still on the stack a pointer to it obtained through
the Lua API remains valid. This applies for example to lua_tothread and
lua_tostring.
--
Wim