lua-users home
lua-l archive

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





> Does this mean that garbage collection for toLua-generated objects/userdata
> will leak? Is there a workaround?
>

it seems it's true. tolua uses a Lua table to check the need of
destructing the object, and that's should not be done. sorry!

if you are not binding functions that return object by value,
you can deactivate the gc tag method
(doing that, objects returned by value will leak).

to deactivate tolua gc, do not set the function "instance_gc" (in tolua_tm.c)
as the gc tagmethod.

the right solution (to be implemented) is to set the tagmethod only for
objects returned by value. doing that, tolua can destruct the object
in the gc function without performing additional checkings.
to do that, it is needed to create a "clone_tag", similar to what is done to
the "const_tag".

this fix will get high priority in my to-do list.

-- waldemar