Hi,

DOM is an in memory representation of your document. The larger your
document the more memory it will consume, so not surprising how much it's
using for a 50 MB document. Use SAX when you don't need the random access.

As for the StackOverflowError you should ask about it on the Xalan mailing
list.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

Torsten <twisted2...@yahoo.de> wrote on 02/19/2010 10:51:38 AM:

> Hi,
>
> I'm using Xerces to parse XML files. However, the mechanism does not
> work anymore if the XML file grows too large.
>
> For example, if I'm parsing a ~50MB file the memory consumption of
> the jvm grows to ~ 400MB and after about 10 mins I get a
> stackoverflow error inside Xerces / Xalan with no hint to the code
> position (see below).
>
> Is that a known behaviour, i.e. is it impossible to access files
> that large, or can this be circumvented by changing the code?
>
> Thanks a lot!
>
> Those are the exceptions:
>
> java.lang.OutOfMemoryError: Java heap space
>  at org.apache.xerces.dom.DeferredDocumentImpl.createChunk(Unknown
Source)
>  at org.apache.xerces.dom.DeferredDocumentImpl.ensureCapacity(Unknown
Source)
>  at org.apache.xerces.dom.DeferredDocumentImpl.createNode(Unknown Source)
>  at
> org.apache.xerces.dom.DeferredDocumentImpl.createDeferredTextNode
> (Unknown Source)
>  at org.apache.xerces.parsers.AbstractDOMParser.characters(Unknown
Source)
>  at org.apache.xerces.jaxp.JAXPValidatorComponent$SAX2XNI.characters
> (Unknown Source)
>  at
>
com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.characters

> (ValidatorHandlerImpl.java:397)
>  at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.characters
> (XMLSchemaValidator.java:749)
>  at
>
com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.characters

> (ValidatorHandlerImpl.java:580)
>  at org.apache.xerces.jaxp.JAXPValidatorComponent$XNI2SAX.characters
> (Unknown Source)
>  at org.apache.xerces.jaxp.JAXPValidatorComponent.characters(Unknown
Source)
>  at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent
> (Unknown Source)
>  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
> $FragmentContentDispatcher.dispatch(Unknown Source)
>  at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
> (Unknown Source)
>  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>  at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>  at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>  at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
>
> java.lang.StackOverflowError
>  at org.apache.xml.utils.SuballocatedIntVector.<init>
> (SuballocatedIntVector.java:115)
>  at org.apache.xml.dtm.ref.DTMDefaultBase.<init>(DTMDefaultBase.java:207)
>  at org.apache.xml.dtm.ref.DTMDefaultBaseTraversers.<init>
> (DTMDefaultBaseTraversers.java:90)
>  at org.apache.xml.dtm.ref.DTMDefaultBaseIterators.<init>
> (DTMDefaultBaseIterators.java:85)
>  at org.apache.xml.dtm.ref.sax2dtm.SAX2DTM.<init>(SAX2DTM.java:253)
>  at org.apache.xml.dtm.ref.sax2dtm.SAX2DTM.<init>(SAX2DTM.java:224)
>  at org.apache.xml.dtm.ref.sax2dtm.SAX2RTFDTM.<init>(SAX2RTFDTM.java:126)
>  at org.apache.xml.dtm.ref.DTMManagerDefault.getDTM
> (DTMManagerDefault.java:307)
>  at org.apache.xpath.XPathContext.getRTFDTM(XPathContext.java:1258)
>  at org.apache.xpath.XPathContext.pushRTFContext(XPathContext.java:1275)
>  at org.apache.xalan.templates.ElemTemplate.execute
(ElemTemplate.java:386)
>  at org.apache.xalan.templates.ElemCallTemplate.execute

<snip/>

> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
> (TransformerImpl.java:2400)
>  at org.apache.xalan.templates.ElemTemplate.execute
(ElemTemplate.java:394)
>  at org.apache.xalan.templates.ElemCallTemplate.execute
> (ElemCallTemplate.java:248)
>  at
> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
> (TransformerImpl.java:2400)
>  at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:128)
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden
> Schutz gegen Massenmails.
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-dev-h...@xerces.apache.org

Reply via email to