> Using the Lua custom allocator is a nice idea, at least this could do > up/down counting to know the number of Lua objects. Is there any > example how to (mis)use lua_setallocf for this See http://www.lua.org/source/5.2/lauxlib.c.html#l_alloc