Re: __gc not being called in LuaJIT

  • From: Sean Dunn <seanedunn@xxxxxxxxx>
  • To: "luajit@xxxxxxxxxxxxx" <luajit@xxxxxxxxxxxxx>
  • Date: Tue, 22 May 2012 23:24:53 -0700 (PDT)

Mike,

Thanks for your informative reply. It helped me realize the actual problem, and 
it had nothing to do with LuaJIT, I'm happy to say.

Sean
 
--


>________________________________
> From: Mike Pall <mike-1205@xxxxxxxxxx>
>To: luajit@xxxxxxxxxxxxx 
>Sent: Monday, May 21, 2012 11:45 AM
>Subject: Re: __gc not being called in LuaJIT
> 
>Sean Dunn wrote:
>> Quick question. I use tolua++ to wrap my C++ classes in LuaJIT.
>> I've noticed that there are situations where LuaJIT does not
>> call the __gc metamethod for my object, which causes a memory
>> leak.
>
>First, please verify first that the standard Lua interpreter does
>not show the problem under identical conditions.
>
>Then I'd need a reduced test case to investigate this further.
>
>> I haven't found anything in the archives mentioning this, but I
>> did notice that the latest beta release 2.0.0-beta10 has the
>> changelog comment "Ensure running __gc of userdata created
>> in __gc at state close."
>> 
>> I take this as meaning that there was memory leak in
>> pre-2.0.0-beta10 builds of LuaJIT. Can someone confirm this?
>
>Well, no there wasn't a general leak. This only happened if you'd
>create a new userdata in the __gc handler for another userdata and
>only if this happened while closing the state. This shoud be a
>rare occurence.
>
>Actually, this problem has been reported for Lua 5.1/5.2 and is
>still present there. I just proactively fixed it for LuaJIT 2.0.
>
>Anyway, if you're using beta10 then that problem shouldn't be
>there anymore.
>
>--Mike
>
>
>
>

Other related posts: