lua-users home
lua-l archive

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


On Tue, Nov 12, 2013 at 10:24 AM, Marc Lepage <mlepage@antimeta.com> wrote:
> 1) You have Lua references to full userdata (and weak references in the
> table)
> 2) The Lua references go away (but the weak reference in the table remains)
> 3) Later in Lua I try to get access to the light userdata and reuse the full
> userdata because it remains in the table as a weak reference
> 4) And that full userdata is still scheduled for collection


as I see it (might be wrong), at step 2, the object isn't "scheduled
for collection", it's "eligible for collection".  it could be
collected at any time while there's no reference to it. but after step
3, there's a new reference, so it's no longer eligible, and it doesn't
get collected.

-- 
Javier