Java GC Tutorials - Herong's Tutorial Examples - v1.12, by Herong Yang
GC Log Message Format for Serial Collector
This section provides explanations on GC log messages generated from the Serial Collector.
The first step to help us understand how Serial Collector works is to understand the GC log messages generated from the Serial Collector.
Let's capture some GC log messages with my sample program, GarbageCollection.java:
herong> java -XX:+UseSerialGC -Xlog:gc,gc+heap=info GarbageCollection [0.019s][info][gc] Using Serial ...
Okay. We got our first GC log message at 0.019 seconds after the application have started. It confirms that the JVM is using the Serial GC.
Continue with additional output in the console:
... Step/TotalMemory/FreeMemory/UsedMemory: 1 127729664 107555136 20174528 2 127729664 105882632 21847032 ... 14 127729664 92701256 35028408 [0.906s][info][gc,heap] GC(0) DefNew: 34207K->4288K(38720K) [0.906s][info][gc,heap] GC(0) Tenured: 0K->13758K(86016K) [0.906s][info][gc ] GC(0) Pause Young (Allocation Failure) 33M->17M(121M) 28.706ms 15 127729664 108238488 19491176
Here are log messages of the first Young (Minor) GC at 0.102 seconds. Here is my understanding of those 3 messages:
Based those messages, we can calculate the following:
Objects removed from Young generation: 34207K - 4288K = 29919K. Live objects moved to Tenured generation: 13758K - 0K = 13758K. Dead objects (garbage) destroyed: 29919K - 13758K = 16161K.
Continue again with additional output in the console:
... 46 127729664 74069456 53660208 [0.591s][info][gc,heap] GC(1) DefNew: 38643K->4287K(38720K) [0.591s][info][gc,heap] GC(1) Tenured: 13758K->44242K(86016K) [0.591s][info][gc ] GC(1) Pause Young (Allocation Failure) 51M->47M(121M) 24.964ms 47 127729664 77015592 50714072 ... 78 127729664 42775624 84954040 [0.617s][info][gc,heap] GC(2) DefNew: 38719K->4287K(38720K) [0.617s][info][gc,heap] GC(2) Tenured: 44242K->73192K(86016K) [0.617s][info][gc ] GC(2) Pause Young (Allocation Failure) 81M->75M(121M) 16.611ms 79 127729664 47170696 80558968
Two more Young (Minor) GC occurred. Let's continue again.
... 109 127729664 13511344 114218320 [0.653s][info][gc ] GC(4) Pause Full (Allocation Failure) 104M->35M(138M) 17.526ms [0.655s][info][gc,heap] GC(3) DefNew: 38669K->0K(38784K) [0.655s][info][gc,heap] GC(3) Tenured: 73192K->36569K(86016K) [0.655s][info][gc ] GC(3) Pause Young (Allocation Failure) 109M->35M(121M) 37.570ms 110 127795200 89572168 38223032
Here are log messages of the first Full (Major) GC at 0.653 seconds. Here is my understanding of those 4 messages:
See next tutorial for more example of Serial Young GC and Full GC messages.
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 - Tight Heap (Part 2)
Serial GC Tracing - Tight Heap (Part 3)
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" 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"
The Z Garbage Collector (ZGC) - "+XX:+UseZGC"
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