Search code examples
javatomcatjvmout-of-memorypermgen

Why is set and actual value of PermSize and MaxPermSize different?


I have set the values of PermSize and MaxPermSize using JAVA_OPTS variable of tomcat as below

JAVA_OPTS="$JAVA_OPTS -XX:PermSize=512M"
JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=512M"

and have the values of Xms and Xmx set as

JAVA_OPTS="$JAVA_OPTS -Xms1024M"
JAVA_OPTS="$JAVA_OPTS -Xmx1024M"

but when I check the actual size of perm-gen using the command jmap -heap [ process id ] they appear as

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 792723456 (756.0MB)
   NewSize          = 1310720 (1.25MB)
   MaxNewSize       = 17592186044415
   OldSize          = 5439488 (5.1875MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   **PermSize         = 21757952 (20.75MB)**
   **MaxPermSize      = 85983232 (82.0MB)**
   G1HeapRegionSize = 0 (0.0MB)


Perm Generation:
   **capacity = 69271552 (66.0625MB)**
   **used     = 69247376 (66.03944396972656MB)**
   **free     = 24176 (0.0230560302734375MB)**
   **99.96509967035242% used**

Why is the actual allocation of permgen space different when campared to what was allocated using the attributes PermSize and MaxPermSize ?

additional info: the RAM of the linux machine on which the tomcat server is installed is:

             total       used       free     shared    buffers     cached
Mem:       3089928    3006592      83336          0      67828    1874144
-/+ buffers/cache:    1064620    2025308
Swap:      1020088        112    1019976

Solution

  • The setenv.sh file was missed during the Jenkins build and this file was sourcing the custom user configurations from tomcat.env thus causing the issue.