Flush DOM Document?
I have an application where I read in some XML via a socket, parse it from a string into an Element, process it, then spit it back out as XML. Each node is independent of each other. Right now, I have a Document in my reading thread that is shared for each node that comes in. The processing step can add considerable data to the node, then it is spit back out.
My problem is that huge amounts of memory are used and seem to stay around. I assume that the Document is holding on to each of these nodes, even though they are never put into the DOM hierarchy.
The question is: should I create a new Document for each node input? It seems like a potential performance hog. Is there some way of telling the document to release references to a Node?
Thanks!

