Memory leak with JAXB

Posted by Anurag on Stack Overflow See other posts from Stack Overflow or by Anurag
Published on 2010-05-26T09:12:18Z Indexed on 2010/05/26 9:21 UTC
Read the original article Hit count: 774

Filed under:
|
|
|

Hi, I am getting Out of Memory error:

Memory Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at org.apache.xerces.dom.CoreDocumentImpl.createElement(CoreDocumentImpl.java:564)

I have a standalone Java program which fetches data from DB and create an XML file using DOM. I get the above error if the data fetched is huge, in my case it is > 1,000,000 records.

I have defined 2GB as heap size while calling the Java class from unix.

I tried it with JAXB, but still do not any significant improvement.

Any suggestions how to improve the code.

© Stack Overflow or respective owner

Related posts about java

Related posts about dom