tags:

views:

68

answers:

2

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?

+2  A: 

You're editing the correct setting (although it's -Xmx, not -xmx), but it sounds like you need to increase it further, e.g.

-Xmx256m

As 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.

skaffman
-XX:+UseCompressedOops helps to reduce the heap size on 64-bit JVM's, with a slight performance penalty incurred.
rhu
+XX:+UseCompressedOops did the trick!
Keith
+1  A: 

Can't out of memory also come form a lack of PermGen? More to memory than just heap

-XX:MaxPermSize=128m
bwawok
It can. But if it does' the OOME's error message will *tell you* that you are out of permgen space. If it doesn't tell you, you would be wise *not* to twiddle that particular knob! Besides, permgen space is *unlikely* to be relevant to reading a JDBC resultset.
Stephen C