[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: lua 5.2 beta manual clarifications on GC and finalizers
- From: Patrick Donnelly <batrick@...>
- Date: Mon, 5 Sep 2011 03:56:54 -0400
[These are questions I think should be answered by the Manual. Not
questions that I have.]
o Can a "resurrected" object (finalizer saves a strong reference to
the object) be finalized more than once?
o In this paragraph:
"Objects marked for finalization have a special behavior in weak
tables. When a marked object is a value in a weak table, it is removed
from the table before running its finalizer. However, when it is a
key, it is removed from the table only after running its finalizer.
This behavior allows the finalizer to access properties associated
with the object through weak tables."
Is the object removed from the weak table even if the finalizer
"resurrects" the object? If not, it probably should be emphasized that
the userdata is always removed when it is a value in a weak table.
o How are the key/value pairs in a userdata's uservalue (table) marked
in the GC sweep before it is finalized (the GC sweep where the
userdata is determined to be unreachable). [This is not clear in the
Lua 5.1 Manual either.] This seems to be a steady source of confusion
as evidenced by the recent postings to lua-l.
- Patrick Donnelly