Hi Gary,

They will usually be eligible for garbage collection, however there are
some operations (e.g. setUserData()) which will pin down the memory even if
the Node is otherwise orphaned. Basically there are a bunch of structures
in the Document node impl which might have back-pointers to other nodes in
the document that can't be cleared until the application no longer has any
references to those nodes. Future versions of Xerces will use
SoftReferences and WeakReferences in these places so such nodes can be
garbage collected earlier.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

"Gary Hirschhorn" <ghirschh...@fetch.com> wrote on 04/22/2009 11:34:46 AM:

> If I create new Nodes via Node.createClone() or Document.
> newElement(), I now have a Node that belongs to a Document, but has
> no parent Node. With regards to garbage collection, if this new Node
> is no longer reachable by the objects in my code, is it eligible for
> garbage collection, or is there some internal pointer from Document
> that will pin this Node in memory until the Document is garbage
collected?
>
> Thanks,
> Gary

Reply via email to