Java heap space error is throwing " while transforming 550 mb document" eventhough heap space is higher than document size

StackOverflow https://stackoverflow.com/questions/22089213

Question

A Java heap space error is thrown " while transforming 550 MB document" even though heap space is higher than a document size.

My code uses

1.xsl:stylesheet of xslt transformation
2.net.sf.saxon.TransformerFactoryImpl
3.trans.transform(new StreamSource(file), result);

Thanks, Mani

No correct solution

OTHER TIPS

Typically with Saxon the space occupied by the source document as a tree is around 5 times the size of the lexical XML. The ratio can vary, of course, depending on the complexity of the document. So for 550Mb, allocating 3Gb should be enough. Use the -Xmx option when starting up Java to allocate enough heap space.

You're close to the limits of what can be done using a conventional in-memory transformation, so you might like to look at the options for doing a streamed transformation. For information on this, see http://saxonica.com/documentation/#!sourcedocs/streaming

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top