[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Memory allocation for userdata
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 16 Dec 2011 07:31:45 -0200
> And using lua_newuserdata for the whole structure is preferable
> because the GC will know the real size of the Lua heap, which is
> impossible if an indirection will be used.
Sure, but it all depends on the library you're binding to Lua.
If it is an external library you may not have a choice. For instance,
the stdio C library does the allocation for your and expects you to
tell it when to free data, hence the gc method (and the explicit close
method) in the io library.