lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Lua version is 5.2.4
> During gc atomic phase, markbeingfnz() mark mark all objects in list of
> tobefnz:
> [...]
> Suppose "Mt" is the metatable of userdata A and B,
> and "Mt" also has __gc finalizer, "Mt" will be linked to g->gray twice,
> first by userdata B   : reallymarkobject(g, B)   -> markobject(g,
> B->metatable) -> linktable
> second by "Mt" itself: reallymarkobject(g, Mt) -> linktable

I did not test your code, but your explanation is convincing. (Except
that it is not clear to me what is the role of 'A' in it.) The bug
is there.

I don't think 5.3 has this problem. (In 5.3, being-finalized objects
go through GC cycles like everybody else, so it never forces a mark
in an object.)

Many thanks for your report.

-- Roberto