4
votes

In JDK 1.6 : I see that full GC has been run but the old generation and perm gen space is not used completely - question is as per my understanding FGC only runs when old gen or perm gen is full - I am not able to understand why it has run even though usage % is low?.

See output of jstat -gcutil below:

  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT
 0.00  82.14  51.17  13.78  26.43    219   19.347     1    0.131   19.479

   S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT
 82.14   0.00   9.12  13.92  26.66    222   19.771     1    0.131   19.902

   S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT
 82.14   0.00  11.07   9.07  24.15    230   20.166     2    1.851   22.017

My min/max heap is 1024M and min and max permGen space is defined as 768M.

3
One possible reason could be RMI: " RMI forces periodic full collection. The frequency of these collections can be controlled with properties.java -Dsun.rmi.dgc.client.gcInterval and -Dsun.rmi.dgc.server.gcInterval" java.sun.com/docs/hotspot/gc1.4.2Anna

3 Answers

1
votes

I resolved the issue by placing the jvm opts : XX:-DisableExplicitGC .

Some code in some external jar file may have been explicitly calling System.gc resulting in such garbage collection behavior. Disabling these, resulted in the expected behavior of Garbage Collection running when 100% usage was about to be reached.

1
votes

Switch on the verbose gc to now exactly when the full gc has happend. Because jstat shows FGC events even for major/tenured collections

For more info visit.

0
votes

FGC only runs when old gen or perm gen is full

It's not true. Read java reference paper here

Memory management in Java may surprise everyone. It takes many years to learn how to set JVM parameters for non-trivial applications.

permGen space is defined as 768M.

Decrease it to 128M