[jdom-interest] JDOM output buffering question

Gamble, Wesley (WG10) WG10 at tmw.com
Tue Jan 15 15:40:19 PST 2008

The reason that I asked my original question was because I was seeing my
memory increase by 200MB and then not get released when my document was
written, and the method that created it exited.


I came upon this thread from a few years ago:




which claims that the SAXBuilder is holding onto a reference that keeps
the document memory from being freed.


Can anyone corroborate this and explain a workaround or JDOM upgrade
that might work?  We are on JDOM 1.0 - is this resolved in 1.1?


The statement in that thread that says "The document won't be available
for garbage collection until the next parse begins."  is interesting to
me - I am never parsing, just writing.  So maybe this is also a bug on
the "way out" as well as on the "way in"?


Also, I didn't quite understand this statement (from Elliotte's reply):
"Even if you can't set it to null, but you could set it to a different
ContentHandler that doesn't have a reference to anything. DefaultHandler
would work nicely for this."


It seems like my trouble may stem from keeping the SAXBuilder object
around as a class variable.


What if I allow my SAXBuilder to be an instance variable, won't its
garbage collection allow for the garbage collection of everything it's







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20080115/681978af/attachment.htm

More information about the jdom-interest mailing list