lua-users home
lua-l archive

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

on 2/16/05 5:59 AM, Roberto Ierusalimschy at wrote:

> Yes, there is such mechanism. Lua ensures that GC methods are called in
> the reverse order of the corresponding userdata creation. Therefore, as
> long as a library was loaded before we start creating its userdata, it
> should be unloaded only after all its userdata is finalized. The bug
> is that Lua is not preserving that order when it closes its state.

Surely this isn't exactly what is meant?

If I write:

    local a = make_userdata()
    _G.liveForever = make_userdata()
    a = nil

Then I would assume that the first userdata item will be finalized and
eventually collected even though we allocated a userdata item after it.