Memory problem with big XML files in fromXML()

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Memory problem with big XML files in fromXML()

Samuel Abreu de Paula
Hi ppl, im using XStream 1.3, and im with trouble getting the objects
from a 12 MB xml file created by Xstream itself.

In first time, i was writing the XML file with: toXML( SomeVector );
Works fine until get a big vector, i solve this problem using: toXML(
SomeVector, bufferedWriter );

Now i have a problem in fromXML, i try this: fromXML( bufferedReader )
and fromXML( new FileInputStream( "file.xml" ) )
In a file with 12 MB i get the following error:
Exception occurred during event dispatching:
java.lang.OutOfMemoryError: Java heap space

The object is a Vector full of some objects created by me.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Memory problem with big XML files in fromXML()

Mauro Talevi
Samuel Abreu de Paula wrote:

> Hi ppl, im using XStream 1.3, and im with trouble getting the objects
> from a 12 MB xml file created by Xstream itself.
>
> In first time, i was writing the XML file with: toXML( SomeVector );
> Works fine until get a big vector, i solve this problem using: toXML(
> SomeVector, bufferedWriter );
>
> Now i have a problem in fromXML, i try this: fromXML( bufferedReader )
> and fromXML( new FileInputStream( "file.xml" ) )
> In a file with 12 MB i get the following error:
> Exception occurred during event dispatching:
> java.lang.OutOfMemoryError: Java heap space
>
> The object is a Vector full of some objects created by me.
>
> Thanks

Have you tried changing the java runtime memory options (-Xms and -Xmx)
to increase the memory available to the JVM?

Cheers


Reply | Threaded
Open this post in threaded view
|

Re: Memory problem with big XML files in fromXML()

Joe Walnes-2
In reply to this post by Samuel Abreu de Paula
On 1/20/06, Samuel Abreu de Paula <[hidden email]> wrote:
> Now i have a problem in fromXML, i try this: fromXML( bufferedReader )
> and fromXML( new FileInputStream( "file.xml" ) )
> In a file with 12 MB i get the following error:
> Exception occurred during event dispatching:
> java.lang.OutOfMemoryError: Java heap space

Hi Samuel,

You may want to try using an object stream instead. See
http://xstream.codehaus.org/objectstream.html

Thanks
-Joe