lua-users home
lua-l archive

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


Ariel Manzur <puntob@gmail.com> writes:
>> Why?  99% of the time, many objects share the same __gc, so there's
>> little point in bloating userdata to make it per-object.
>
> we've had problems with the amount of userdata waiting to be
> collected, so it'd be nice to know which ones actually have a __gc..
> in the case where userdata is used to represent C objects, not all the
> instances need the finalizer, so usually the __gc just acts as a
> proxy. In that case, just looking into the metatable is not enough.

So, you can have your particular userdata store the information you need
(add a field to the beginning, or as Roberto notes, use the env field or
somethign) -- but there seems no reason to change the existing __gc
mechanism...

-Miles

-- 
Acquaintance, n. A person whom we know well enough to borrow from, but not
well enough to lend to.