[Tarantool-patches] [PATCH luajit v2] test: fix flaky OOM error frame test

Igor Munkin imun at tarantool.org
Mon Nov 20 17:53:22 MSK 2023


Sergey,

On 18.11.23, Sergey Bronnikov via Tarantool-patches wrote:
> Hello, Max
> 
> LGTM with a question below
> 
> 
> On 11/9/23 16:45, Maksim Kokryashkin wrote:

<snipped>

> > 
> > +collectgarbage()
> 
> Probably it is obvious, but I don't get it.
> 
> Usually for forcing garbage collecting one need call `collectgarbage()` two
> times:
> 
> for mark and sweep. You call it single time, why?

The reason of two consequent <collectgarbage> calls is not for "mark and
sweep" but rather for "full GC cycle + finalization of the resurrected
objects". The first call implements full (even 1.5) GC cycle; as a
result of this call some *objects* can be *released*, but the
corresponding *memory* is preserved in another list (gc->mmudata, IIRC)
to properly finalize the object (i.e. call __gc metamethod). Hence, the
second call finally releases the memory for the objects resurrected
within the sweep phase of the first call.

Since Max allocates plain FFI objects with no <ffi.gc> finalizers,
there is no need in the second <collectgarbage> call here.

> 

<snipped>

> > 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list