Joe Joe - 1 year ago 94
Java Question

Java5 -XX:MaxHeapFreeRatio=45 doesn't release heap even when more than 45% of the heap is free

I have a java application with the arguments below but the heap is not getting reclaimed even when the total free space is greater than 45% (can see via visual VM). Is there any reason that the JVM wouldnt free that heap space? The same settings work as expected in Java6. Running Java5 runtime and compile time

java -jar -Xmx1024m -XX:MinHeapFreeRatio=15 -XX:MaxHeapFreeRatio=45 -XX:+HeapDumpOnOutOfMemoryError <myjarname>

Joe Joe
Answer Source

We believe we have found an answer to the question. The systems we are running are server class machines with multiple CPUs the JRE was detecting the multiple CPUs and setting the GC to use parallel instead of serial GC which is not compatible with the XX:MaxHeapFreeRatio setting.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download