Java 8 GC Tutorials - Herong's Tutorial Examples - v1.03, by Dr. Herong Yang
Usage Report on Heap Memory Areas
This section provides explanations of the usage report on heap memory areas generated by the '-XX:+PrintGCDetails' option.
If the "-XX:+PrintGCDetails" option is used, HotSpot JVM also generates a nice summary report on usages of different Heap memory areas when the application is terminated.
Rerun GarbageCollection.java with the "-XX:+PrintGCDetails" option for a few seconds, and press Ctrl-C to terminate it. You will see the usage report of heap memory areas on the console:
herong> \progra~1\java\jdk1.8.0\bin\java -Xms10m -Xmx10m -XX:+UseSerialGC \ -XX:+PrintGCDetails -XX:+PrintGCTimeStamps GarbageCollection Step/TotalMemory/FreeMemory/UsedMemory: 1 10158080 8629864 1528216 2 10158080 7563632 2594448 2.148: [GC (Allocation Failure) 2.150: [DefNew: 2533K->320K(3072K), ... 3 10158080 6685688 3472392 4 10158080 5593720 4564360 4.164: [GC (Allocation Failure) 4.165: [DefNew: 2964K->320K(3072K), ... 5 10158080 4554136 5603944 6 10158080 3460808 6697272 (Ctrl-C) Heap def new generation total 3072K, used 2053K [0x04a00000, ... eden space 2752K, 62% used [... from space 320K, 100% used [... to space 320K, 0% used [... tenured generation total 6848K, used 4596K [0x04d50000, ... the space 6848K, 67% used [0x04d50000, 0x051cd3b8, ... Metaspace used 1561K, capacity 2242K, committed 2368K, reserved 4480K
Here is how we can read the heap area usage report in the "heap" section:
Note that when the heap size is specified as 10 MB by -Xms10m -Xmx10m, the JVM is automatically gave 3072K to the "new" generation, and 6848K to the tenured generation. It's about 30% for the "new" generation, and 70% for the tenured generation.
Table of Contents
Heap Memory Area and Size Control
JVM Garbage Collection Logging
Introduction of Garbage Collectors
►Serial Collector - "+XX:+UseSerialGC"
GC Log Message Format for Serial Collector
GC Log Message Examples of Serial Collector
Log Message Types from Serial Collector
Serial Collector Stops Application for Minor/Major GC
►Usage Report on Heap Memory Areas
Default NewRatio - Old vs. New Generation
"-XX:NewRatio" - Ratio of Tenured and "new" Generation
"-XX:SurvivorRatio" - Ratio of Eden and Survivor Space
Serial GC Tracing - Tight Heap
Serial GC Tracing - Plenty of Heap
Serial GC Tracing - Aged Live Objects
Serial GC Tracing - Tenuring Threshold
"-XX:TargetSurvivorRatio" - Second Tenuring Condition
Serial GC Tracing - Tenuring Threshold Controlled
"-XX:+NeverTenure" and "-XX:+AlwaysTenure" not Working
Minor GC Triggering Condition of Serial Collector
Parallel Collector - "+XX:+UseParallelGC"
Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"
Garbage First (G1) Collector - "+XX:+UseG1GC"
Object References and Garbage Collection
Garbage Collection Performance Test Program
Performance Tests on Serial Collector
Performance Tests on Parallel collector
Performance Tests on Concurrent collector
Performance Tests on G1 collector