aspose file tools*
The moose likes Java in General and the fly likes Out of Memory error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Out of Memory error" Watch "Out of Memory error" New topic
Author

Out of Memory error

Ravindra Nandyala
Greenhorn

Joined: Jun 17, 2008
Posts: 7
Hi All,

I have written a standalone java program that fetches records from the database and calculates the checksum of each table.

The problem I am facing is with tables containing huge data sets, my program resutls in an Out of Memory error.


Below is the error that I get when I run the program with following options :

java -Xms256m -Xmx1536m DatabaseCheck.DBCheckSum

JVMDG303: JVM Requesting Java core file
JVMDG304: Java core file written to /opt/projects/gsd/java/DatabaseCheck/javacore430152.1231233966.txt
JVMDG274: Dump Handler has Processed OutOfMemory.
JVMST109: Insufficient space in Javaheap to satisfy allocation request
Exception in thread "main" java.lang.OutOfMemoryError

I have tried using setFetchSize(Integer.MIN) method to limit the number of records retrieved but this approach also does not work.

Below is sample code of my program:




If anybody can help me with this then it will be great!

Thanks
Ravi.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You know, each byte of a byte[] allocates exactly one byte of memory?

Can you now imagine what will happen if the byte[] contains more bytes than the JVM available memory?

Either give it more memory or buffer the bytes in an InputStream.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Out of Memory error