[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Confused by Lua garbage collection tear down order when there are references between objects
- From: Coda Highland <chighland@...>
- Date: Wed, 21 May 2014 23:11:34 -0700
On Wed, May 21, 2014 at 8:53 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
> Am 22.05.2014 04:57 schröbte Coda Highland:
>> At this point, my personal recommendation would be to use tables
>> containing a lightuserdata, and maintain a C-side refcount independent
>> of the Lua refcount.
>
> This sounds like manual resource management to me, but I can't imagine a
> situation where lightuserdata would solve an object lifetime problem anyway,
> so I might be missing something here.
It's more that full userdata becomes pointless if you're not using it
to manage the object lifetime anymore, so switching to lightuserdata
lets you do equality comparisons on return values from C, including
mapping the lightuserdata back to the Lua object; you can't do this
with full userdata without attaching another key to it.
/s/ Adam
- References:
- Confused by Lua garbage collection tear down order when there are references between objects, Eric Wing
- Re: Confused by Lua garbage collection tear down order when there are references between objects, Tim Hill
- Re: Confused by Lua garbage collection tear down order when there are references between objects, William Ahern
- Re: Confused by Lua garbage collection tear down order when there are references between objects, Eric Wing
- Re: Confused by Lua garbage collection tear down order when there are references between objects, Philipp Janda
- Re: Confused by Lua garbage collection tear down order when there are references between objects, Eric Wing
- Re: Confused by Lua garbage collection tear down order when there are references between objects, Philipp Janda
- Re: Confused by Lua garbage collection tear down order when there are references between objects, Eric Wing
- Re: Confused by Lua garbage collection tear down order when there are references between objects, Coda Highland
- Re: Confused by Lua garbage collection tear down order when there are references between objects, Philipp Janda