Results 1 to 2 of 2
- 05-20-2007, 08:51 PM #1Member
- Join Date
- May 2007
- Rep Power
OutOfMemoryError while creating a new object of file with size more than 150 MB
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 150 mb, it is running out of memory while creating the object of that particular file. Can some one help me by telling if there is a way to resolve this issue?
- 05-20-2007, 08:52 PM #2levent Guest
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 was 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.
- By Java Tip in forum java.langReplies: 0Last Post: 04-15-2008, 07:38 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 01-16-2008, 11:24 AM
- By kavithas in forum New To JavaReplies: 0Last Post: 11-30-2007, 01:00 PM
- By ravian in forum New To JavaReplies: 0Last Post: 11-12-2007, 10:19 AM
- By venkatv in forum New To JavaReplies: 3Last Post: 07-17-2007, 03:33 PM