[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Garbage collecting locals
- From: Falko Poiker <fpoiker@...>
- Date: Wed, 21 Feb 2001 12:10:08 -0800
> >Do local variables get garbage collected when the
> >block that contains them is over?
> Just to be picky: the *values* of the local variables
> for which there are no other references are collected
> in the next cycle after the block ends.
How do you define "for which there are no other references"?
I create a local variable that is a userdata pointer to an object in my c++
code. At the end of the block, how does lua know (or what determines) if
there are no other references to that object?
Basically, I was hoping that the fact that the userdata is local indicates
that the variable value would be collected once it's out of scope (so that
the object the userdata points to gets deleted as well).
> >Is there a way to force garbage collection in general?
I find it strange that there is no C API function that does the same thing,
only a lua library function. What if the code lua is embedded in wants to
force garbage collection?