[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: [Lua] Garbage collector
- From: "liam mail" <liam.list@...>
- Date: Tue, 26 Feb 2008 20:57:06 +0000
If a Lua (5.1) function creates a local variable(actually it is a userdata and metatable with __gc method set ) and returns it to Cpp pushing it onto the stack, when does the garbage collector kick in for this variable.?
Is it when the value is popped off the stack that the variable becomes "no longer active" or at a later time?
About the objects stored within local variables: at the moment the local variable is no longer active the GC may
collect the object that was stored there. The actual freeing of the
object has nothing to do with function scopes or variable live times.
The GC runs at certain times and frees all objects that are no longer
accessible by any L"