[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Order of weak ref removal and __gc
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sun, 8 Aug 2010 19:29:19 -0300
> If I have a weak ref to a user data (as a value) in a table, is it
> possible for the weak ref to be removed long before the userdata's
> __gc metamethod is called? Does this happen in multiple passes of the
> collector?
No. The weak reference should be cleared before the _gc metamethod is
called. (If the userdata is a key instead of a value, then it is
removed only after running the _gc metamethod.)
-- Roberto