Home arrow static arrow Java Programming [Archive] - outofmemory while creating a new object of file with size more than 100 MB
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - outofmemory while creating a new object of file with size more than 100 MB
This topic has 1 reply on 1 page.

Posts:10
Registered: 5/27/04
outofmemory while creating a new object of file with size more than 100 MB  
Aug 1, 2004 1:22 PM



 
I have created an application which generates a report by getting the data from our archived files (.zip file).By the time, the application is reaching a file with size more than 100 mb, it is running out fo memory while creating the object of that particular file. Can some one help me by tellin if there id way to resolve this issue?

Thanks in advance
 

Posts:37,103
Registered: 3/30/99
Re: outofmemory while creating a new object of file with size more than 100 MB  
Aug 1, 2004 2:50 PM (reply 1 of 1)



 
If you're getting OutOfMemoryError, the simplest thing to try is to give the VM more memory at startup. For Sun's VM, I believe the default is 64 MB. You can increase this by using the -X args that control the heap size. For example:
java -Xms128m -Xmx256m ... etc. ... 

This says start with 128 MB of heap, and allow it to grow up to 256 MB.

One thing to consider, though, is do you need that much stuff in memory at once? A more intelligent approach might be to unpack the archive to the file system, and then read a file at a time or a line at a time or a whatever at a time is appropriate for the processing you need to do.
 
This topic has 1 reply on 1 page.