[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: finalizer not called for userdata created inside finalizer
- From: Josh Haberman <jhaberman@...>
- Date: Wed, 11 Apr 2012 12:16:32 -0700
On Wed, Apr 11, 2012 at 12:00 PM, Robert G. Jakabosky
<bobby@sharedrealm.com> wrote:
> On Wednesday 11, Josh Haberman wrote:
>> I see. In that case, using finalizers to implement a Lua-level
>> atexit() doesn't seem like a viable technique.
>>
>> https://github.com/dcurrie/lunit/blob/master/atexit.lua
>>
>> Is there any other way to accomplish this?
>
> [code snipped]
I'm confused; this seems equivalent to the code I linked to. It
similarly runs the atexit() handlers inside a finalizer. I tried it
with my test case (replacing "defer" with your "atexit") and it does
not print "GC'd".
Josh