lua-users home
lua-l archive

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

Gaspard Bucher wrote:
> I do not have any finalizers in the userdata.

I think it doesn't really matter. The fact is that garbage collector
sometimes doesn't collect all garbage in one cycle. One possible cause
are finalizers. In your case, it's probably a complicated dependency
graph with circular references. (For curiosity's sake, try to run
collectgarbage() multiple times instead of one and see if the program
still crashes)

Combined with weak tables, this can be dangerous. I believe that one
should not rely on GC to remove entries from weak tables (probably
except the case of "direct cache" when userdata are values in a weak
table), and remove these entries manually.

I think this shouldn't be considered a bug in Lua, but rather a feature
of its garbage collector and weak table semantics.