I get a java.lang.OutOfMemoryError: Java heap space message when reading from an 11g Oracle database via JDBC. I have the defaultRowPrefetch set to 10000, reducing it to 2000 seems to resolve the issue. However, adding additional memory to the JVM (-xmx) does NOT resolve the issue. This issue only seems to occur in 64-bit java 1.6 – I was not seeing this issue in 32-bit java.
My question, what setting can I change to allow my application to run with the larger defaultRowPrefetch?
You’re editing the correct setting (although it’s
-Xmx, not-xmx), but it sounds like you need to increase it further, e.g.-Xmx256mAs far as the 64 bit thing is concerned, you’ll find that a 64bit JVM uses up heap much faster than a 32bit JVM (which makes sense, the pointers are twice the size), so a 64bit JVM needs more heap anyway.