[jdom-interest] large number of objects in heap

philip.nelson at omniresources.com philip.nelson at omniresources.com
Sat Aug 25 08:37:26 PDT 2001

XML documents in memory are hogs and nobody including JDOM has yet to
improve dramatically on that.  But...

The char[] are not created anywhere in JDOM that I can recall so Crimson may
be the suspect for that.  You should try some different parsers.  Try MinML2
if your documents can be parsed  by it.  Try Xerces of course.

Strings, of course.  Pretty much everything is kept as a string (which may
in turn allocate char[]).
The parser may also be interning the strings.  Arraylists, of course.  Every
element has an ArrayList of content and Attributes.  At the most basic
level, a JDOM document is a structure of ArrayLists containing ArrayLists
and strings.

xmlDocumentScanner$ContentDispatcher.dispatch() is not a JDOM method of
course.  Trying a different parser to change this.  Remember though that
SAXHandler is a callback to whatever parser you are using so just looking at
the originating methods where allocation occurs is not going to be real
helpful at determining whether its the parser or JDOM that is less than
optimal.  Another approach may be to serialize the document and then analyze
readObject which would eliminate the parser from the list of variables.

Of course, if you find any smoking guns, let us know!

-----Original Message-----
From: Carey Boldenow [mailto:c.boldenow at cytera.com]
Sent: Saturday, August 25, 2001 9:48 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] large number of objects in heap

We have been experiencing out of memory exceptions in our application and
while running Optimizeit on our application we noticed that there is a huge
number of objects in the heap (char[], Strings, and ArrayLists). While
following back the tracing, we found that the majority of these objects are
originating from JDOM and specifically
xmlDocumentScanner$ContentDispatcher.dispatch() and other SAXParser methods.
Worse yet, it appears as though these objects never get garbage collected.
We are using Build 7 with the default parser (crimson). Is this to be
expected or are we missing something possible in our code?

Thanks for your help

More information about the jdom-interest mailing list