Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am running a Tomcat site(with an NGinx front end) that seems to be randomly running out of memory even though the max heap size is pretty large. My question is is it possible for the JVM to get an OutOfMemory error even if the heap size is significantly less than -Xmx? For instance, here is a snapshot I took just 15 seconds before an OutOfMemory error:

Tue Dec 18 23:13:28 JST 2012 Free memory: 162.31 MB Total memory: 727.75 MB Max memory: 3808.00 MB

I guess theoretically it's possible that my code generated 3 gigs worth of objects in 15 seconds, but I highly doubt it. It seems like the JVM was unable to grow the heap even though it theoretically had room....Is it possible that other processes started using memory to the point that the JVM could not grow? I am running 64-bit Oracle Hotspot on a 64 bit vm running CentOS 5 with 6 gigs of ram.

share|improve this question

1 Answer 1

In Java there are many different pools of memory, thus eventhough you have enough heap size, you can still run out of memory. Here is an extract of a couple of other settings I have used at other java sites to experiment on your own with. I suggest that you consult the Java documentation also.

 .
 .
 .
 export JAVA_OPTS=" -XX:PermSize=32m -XX:MaxPermSize=512m ${JAVA_OPTS}"
 export JAVA_OPTS=" -XX:NewSize=4096m -XX:MaxNewSize=4096m -XX:SurvivorRatio=8 ${JAVA_OPTS}"
 .
 .
 .
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.