Using both Sun's and Apache's(Xerces) implentations of the SAX XML paser, it appears that it requires over 7 MEGS of heap space to parse a 150 kilobyte XML document. I can understand a DOM parser having this kind of footprint, but why would a Java SAX parser need such an absurd amount of memory?

Serge Knystautas

When writing software, you have three areas you have to try to balance... speed, memory usage, and size of code. These commercial parsers are generally optimized purely for performance and require a lot of overhead. Also, assuming they make extensive use of Strings, in Java this creates a lot of object overhead.

There are XML parsers out there that are optimized for a smaller code footprint and less memory overhead including MinML at http://www.wilson.co.uk/xml/minml.htm and NanoXML at http://nanoxml.sourceforge.net/.