lua-users home
lua-l archive

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

On Mon, Oct 01, 2001 at 03:56:18PM -0700, Paul Hsieh wrote:
> Even if that is so, how do I get a callback into my embedding
> program to call the "destructor" at the time of garbage collection
> for a userdata that I've created?  The objects I intend to create in
> my program will be numerous, and use a lot of system resources
> (including a seperate thread), so I need for them to be recycled
> whenever possible.  Is there something I am missing, or is Lua
> simply not a state where it can solve my problem? 

You might want to take a look at the tolua library source code for
ideas, particularly tolua_tm.c. Basically it uses the "gc" tag method
to destroy objects and free up the memory associated with them.

- Christian