[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: order of destruction of variable by the garbage collector
- From: RLake@...
- Date: Thu, 22 Jan 2004 03:56:21 +0000
Mark Hamburg escribió:
> Beware, however, with respect to the weak table
dependency mechanism. If it
> just provides acyclic dependencies you are fine. If, however, it is
used for
> more general references, then I think partially weak tables can result
in
> uncollectable cycles.
Yes, I maybe should have been clearer about that.
I am acutely aware of
the cyclical weak table reference problem :) That
is why I deliberately
called the sample function I wrote "gcafter"
as opposed to, say,
"registerreference". If you wrote:
gcafter(a,b); gcafter(b,a)
you would probably expect either an error message
or at least for neither
a nor b to be garbage collectable (the latter is what
will happen in the
code I suggested). It is, at least, a "heads-up".
This is also the reason why I didn't provide a deletedependency
function;
the obvious solution of using a reverse weak table
will create cyclical
references, so the only solution is a brute-force
examination of the
dependency table.
Perhaps we will see a solution to this problem in
a future Lua version.
It appears that the issue crops up more often than
was originally thought
(including by me).