lua-users home
lua-l archive

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

Hi Sylvain,

I think that since you want that the lua GC manage the allocated
memory you should allocate the memory with lua. You can do that very
easily in C++ with placement new and explicit destructor call or in C
by using the lua_newuserdata instead of malloc to allocate the whole

I'm using this techniques both with C and C++ code and it works like a
charm, it is more simple and you reduce memory fragmentation.

I hope that helps.