lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


What if I did this:

[LUA CODE]
red_door=32

and then run millions of things for about 24 hours. If I dont touch the 'red_door' var, will it be gc'ed after that long period of time?


From: Edgar Toernig <froese@gmx.de>
Reply-To: lua-l@tecgraf.puc-rio.br
To: Multiple recipients of list <lua-l@tecgraf.puc-rio.br>
Subject: Re: Garbage Collection
Date: Mon, 27 Aug 2001 04:26:12 +0200

Denis Lamarche wrote:
>
> Does Lua garbage collect its own variable or those on the stack or both?
> If I set the gc tag of a lua variable to nil, will it still be collected be
> the gc?

Hmm... you can't set tags on variables. Only on tables and userdata objects.
So I guess you mean that.  Yes, they will be collected.  The gc tag allows
you to set callback functions for userdata objects.  It's just a function
that gets called just before the object is freed.  And the object will be
freed when it's no longer used, whether you set a gc-function or not ;-)

Ciao, ET.


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp