W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

RE: An observation about "live" NodeLists

From: Miles Sabin <msabin@cromwellmedia.co.uk>
Date: Tue, 20 Oct 1998 15:49:31 +0100
Message-ID: <c=US%a=_%p=Cromwell_Media%l=ODIN-981020144931Z-24680@odin.cromwellmedia.co.uk>
To: "'Arnaud Le Hors'" <lehors@w3.org>, "'www-dom@w3.org'" <www-dom@w3.org>
Arnaud Le Hors wrote,
> keshlam@us.ibm.com wrote:
> > Since Java's GC-based, making the Nodes aware of the 
> > NodeLists means the NodeList objects have to persist
> > as long as the Nodes they're based on do; there's no 
> > architected way to tell the DOM that they're no longer
> > needed.
> I know we can't rely on this yet but the WeakReferences
> in Java 1.2 will greatly help address this problem.

Sadly not ... even with 1.2 weak refs we still have no
guarantees on how soon we will be notified that an object
has only weak refs to it. Basically the situation is
much the same as it is with finalize() ... the only
difference is that the strong ref/strong ref cycle that
JK is worrying about (because it prevents GC) can be
broken by replacing it with a strong ref/weak ref cycle
(which will allow GC). But we're still at the mercy of
the indeterminacies of Java GC.

There is, in any case, a way of dealing with the cycle
that gets you just as much/little as weak refs, but is
fine with Java 1.1 ... hint, try a combination of the
handle-body idiom with finalize().

Err ... I can elaborate on that if it's not too far off
topic for this list ...



Miles Sabin                          Cromwell Media
Internet Systems Architect           5/6 Glenthorne Mews
+44 (0)181 410 2230                  London, W6 0LJ
msabin@cromwellmedia.co.uk           England
Received on Tuesday, 20 October 1998 10:54:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:05 UTC