RE: Walking the DOM (was: XML APIs)

John Cowan wrote,

> Miles Sabin wrote:
> 
> > > Actually I *was* thinking of invalidating all iterators, on
> > > the assumption that the number of iterators is typically small,
> > > even if we can't (due to garbage-collection considerations)
> > > determine its actual value.
> > 
> > It's precisely because of GC that we *can't* assume that the
> > number of iterators is small.
> 
> For "iterators" read "active iterators".

Yes, but how can an implementation tell whether or not an iterator
is active? The only way is for it to wait for it to become
unreferenced, and the only way of knowing that is to wait for it
to be GC'd and have it's finalize method called ... weak
references work in more or less the same way: there's a bit of JVM
support, but the mechanism is still dependent on GC.

The upshot is that whatever you as the programmer might think of
as the number of "active" iterators, the implemenations idea of
the number of active (or, equivalently, not known to be inactive)
iterators could be significantly greater ... potentially
unnacceptably so.

Cheers,


Miles

-- 
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 Thursday, 12 November 1998 05:54:03 UTC