[XOM-interest] XOM memory usage

Elliotte Harold elharo at metalab.unc.edu
Wed Sep 26 20:05:17 EDT 2007


Marcus Downing wrote:
> I've successfully used XOM on many reasonable-sized documents. Now I
> need to parse a 10Mb xml document, and the memory usage is just too
> much.
> 
> I manage to process about 90% of the elements before hitting an
> OutOfMemoryError, which suggests that something is a being assigned
> and held onto as each element is parsed. Is there anything I should be
> doing to minimise the memory use or release elements which are no
> longer needed?
> 

Like most tree models, XOM sucks the whole document into memory and 
holds onto it. You can't release it in pieces. That said, 10MB should be 
well within its capabilities on any modern hardware. Have you profiled 
it to see where the memory is going?

You can process documents larger than available memory but you need to 
use a NodeFactory. See the FAQ at

http://xom.nu/faq.xhtml#d0e286


-- 
Elliotte Rusty Harold  elharo at metalab.unc.edu
Java I/O 2nd Edition Just Published!
http://www.cafeaulait.org/books/javaio2/
http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/


More information about the XOM-interest mailing list