[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question about the Lua GC
- From: Jamie Webb <j@...>
- Date: Fri, 30 Apr 2004 12:17:48 +0100
On Friday 30 April 2004 07:00, Joel Pritchett wrote:
> How does the Lua GC determine whether or not something should be
> removed? Is it possible to influence this logic in any way? We have
> recently run into a problem where LUA is aggressively removing threads
> created via lua_newthread from the state that they were created from
> before they have reached completion. The threads are still yielded and
> it would be nice if they would be allowed to run to completion.
Objects may be GCed when they are no longer 'live'. An object is considered to
be live if it is:
a) On the stack
b) In the registry
c) In the globals table
d) Referenced by a /Lua/ object that is live (excepting weak tables).
Just because a thread has not terminated does not make it live, so to ensure
that it is not GCed you need to put a reference to it in one of the above
places; probably the registry.
-- Jamie Webb