Re: Hello and NodeIterator Revisited

Don Park wrote:

> Well, it turns out that weak references are not needed.  The real problem I
> see at this point is that NodeIterators are used too often without any
> facility for recycling.  One NodeIterator is instantiated for each Element
> with children and another is needed to iterate attributes.  This is
> sufferable if each elements are relatively heavy but if elements are being
> used like the way HTML is being used, you can expect quite a trashing from
> GC.

Although I am not deep into this ongoing discussion, I will add my comments
anyway.
>From an outsiders point of view it seems, you hit the usual problem of
inefficient
reuse of objects. From a practical view it is desirable to achieve good
performance,
so explicit reuse in the API would be appropriate. From an API view I would
think
this be rather poor practice, because it will move the burden of memory
allocation
to the API programmer (once again). Recycling of these kinds of small objects,
should be handled by the memory manager in conjunction with the garbage
collector.
The mem-man could detect intensive allocation/deallocation of certain objects
and
apply a recycling scheme.

--
Torben Espersen
torbene@diku.dk

Unite for Java - Join the Java Lobby!
http://www.javalobby.org

Received on Thursday, 7 May 1998 05:25:51 UTC