lua-users home
lua-l archive

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


> I have a defined a userdata type (an image) that holds large
> quantities of
> memory. Obviously, this data type should be garbage collected
> as soon as
> possible to release resources.

This problem looks familiar. There have been long threads on the .NET
maillist and newsgroups about deterministic finalization.
Anyway, the one thing you can do is to provide two ways of deallocation: one
via GC, and one via a custom call which leaves the userdata floating around
but deallocates the large buffers. At GC time you simply check if the
buffers are still allocated or not.
--
WildHeart'2k - mailto:stf@apl.it
Homepage: http://come.to/wildheart/

<<<Borrow money from a pessimist: ---
   they don't expect it back.>>>