Why is my garbage collection log showing 3.8 GB as the maximum heap size while I allocated 4 GB as the maximum heap size?

I have a 64 bit JDK version 1.7.0 installed on a 64 bit RHEL 6 machine. I am using the following JVM options for my tomcat application.

CATALINA_OPTS="${CATALINA_OPTS} -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=EST5EDT"

# General Heap sizing
CATALINA_OPTS="${CATALINA_OPTS} -Xms4096m -Xmx4096m -XX:NewSize=2048m -XX:MaxNewSize=2048m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:+UseCompressedOops -XX:+DisableExplicitGC"

# Enable the CMS GC policy
CATALINA_OPTS="${CATALINA_OPTS} -XX:+UseConcMarkSweepGC -XX:CMSWaitDuration=15000 -XX:+CMSParallelRemarkEnabled -XX:+CMSCompactWhenClearAllSoftRefs -XX:+CMSConcurrentMTEnabled -XX:+CMSScavengeBeforeRemark -XX:+CMSClassUnloadingEnabled"

# Verbose Garbage Collection Logging
CURRENT_DATE=`date +%Y%m%d%H%M%S`
CATALINA_OPTS="${CATALINA_OPTS} -verbose:gc -XX:+PrintGCDetails -Xloggc:${CATALINA_BASE}/logs/gc-${CURRENT_DATE}.log -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution"

      

When I do garbage collection analysis, the GC logs show the maximum available heap of just 3.8 GB instead of the 4 GB allocated to the JVM. Why is this?

+3


source to share


1 answer


The new generation (2048M) consists of 80% Eden (1638.4M) and two Survivor Spaces (10% or 204.8M each):

Heap
 par new generation   total 1887488K, used 134226K [0x00000006fae00000, 0x000000077ae00000, 0x000000077ae00000)
  eden space 1677824K,   8% used [0x00000006fae00000, 0x00000007031148e0, 0x0000000761480000)
  from space 209664K,   0% used [0x0000000761480000, 0x0000000761480000, 0x000000076e140000)
  to   space 209664K,   0% used [0x000000076e140000, 0x000000076e140000, 0x000000077ae00000)
 concurrent mark-sweep generation total 2097152K, used 242K [0x000000077ae00000, 0x00000007fae00000, 0x00000007fae00000)

      



At any time, one of the surviving spaces is empty (see Generations ).
So the usable heap size is1638.4 + 204.8 + 2048 = 3891.2 MB

+2


source







All Articles