java.lang.OutOfMemoryError: Java heap space using jre 1.6.0

Hi,I try to use a SAX parser to read a XML document (about 400MB).With jre 1.5.0 everything ist fine. Now I tried to use jre 1.6.0 and geht this OutOfMemoryError.Can you tell me how to fix this problem?thx
[240 byte] By [-Angie-a] at [2007-11-27 2:08:45]
# 1
There is a possibility that the GC ergonomics has changed it's behavior in the 6.0 release. Try specifying the heap size explicitly with an -Xmx command line key.Igor Veresov, Hotspot GC
ihva at 2007-7-12 1:58:25 > top of Java-index,Desktop,Runtime Environment...
# 2
I think i forgot to tell that i run the program with 420MB heap space in both cases. More is simply not possible on my system.Perhaps someone has another idea what else to do?!
-Angie-a at 2007-7-12 1:58:25 > top of Java-index,Desktop,Runtime Environment...
# 3

420 MB total heap for a 400 MB XML file doesn't seem to be very much. But if it really runs with 5.0, you might want to try to set the New Generation to a fixed (rather small) size, leaving more space for the Old Generation.

Try to add

-XX:NewSize=8M -XX:MaxNewSize=8M

to your parameters. (8M is just a guess...)

Nick.

nicolasmichaela at 2007-7-12 1:58:25 > top of Java-index,Desktop,Runtime Environment...
# 4
I don't think that 420Mb is not very much for reading the XML file because I'm using a SAX Parser which doesn't load the complete file.In 5.0 it is also running with fewer HeapSpace.However I tried what you suggested but unfortunately this doesn't work either.
-Angie-a at 2007-7-12 1:58:25 > top of Java-index,Desktop,Runtime Environment...
# 5

I had a similar problem (see the stack trace below). There is a known bug

(http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6536111) in this

regard. As a workaround I had to skip the DOCTYPE declaration from

the input stream and then let the parser parse the remaining stream

content.

java.lang.OutOfMemoryError: Java heap space

at com.sun.org.apache.xerces.internal.util.XMLStringBuffer.append(XMLStringBuffer.java:205)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.refresh(XMLDocumentScannerImpl.java:1493)

at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.invokeListeners(XMLEntityScanner.java:2070)

at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(XMLEntityScanner.java:1415)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2777)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)

kunapulira at 2007-7-12 1:58:25 > top of Java-index,Desktop,Runtime Environment...