[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Garbage collection / finalization of Lua functions
- From: Dibyendu Majumdar <mobile@...>
- Date: Sun, 6 Sep 2015 18:06:53 +0100
On 6 September 2015 at 14:53, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> Putting a call to lua_gc(L, LUA_GCSTEP, 200) after every JIT
>> compilation seems to help but then causes tests in gc.lua to fail
>> (don't know why).
>>
>> [...]
>>
>> Any pointers on where I should look for how to solve this in a better way?
>
> You should look at the tests :-)
Do you mean look at the tests for a solution? Or do you mean that
using GCSTEP is the right thing to do, but look at the tests for the
cause of the test failure? (From below I think you mean the latter).
> Tests in gc.lua (and some other places)
> assume some specifc behhavior of the gc (e.g., it will not trigger a
> new cycle immediately after the last one); small changes in GC hehavior
> can break the tests without violating anything about the official
> specification.
>
Ok, I will have to see how to avoid breaking the tests.
BTW calling lua_gc() from inside luaD_precall() (where JIT compilation
takes place) causes an assertion failure when ltests is linked - the
assertion fails as lock count was not equal to 0 when entering
lua_gc(). So I had to wrap the call to lua_gc() in unlock/lock - but
not sure if this is the right thing to do.
Regards
Dibyendu