lua-users home
lua-l archive

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


> I tried doing a simpler mockup to see what happens if I create
> newuserdata during an object's finalizer. It looks like the problem is
> still lua_close. But this time it looks like that lua_close may not
> get around to cleaning up these new objects at all.

This is documented behavior:

  When you close a state (see lua_close), Lua calls the finalizers of
  all objects marked for finalization, following the reverse order that
  they were marked. If any finalizer marks new objects for collection
  during that phase, these new objects will not be finalized.

(Otherwise bad objects could create a loop so that 'lua_close' would
never finish.)

-- Roberto