Minor GC Triggering Condition of Serial Collector

This section describes the triggering condition of the Serial collector Minor GC process. The condition is the failure of new object allocation in 'eden'.

We know that when the "eden" space is full, the Serial collector will start a Minor GC. What is the exact definition of full? Is it 90% full or 100% full?

By looking at GC log messages, I think the exact definition is that "There is not enough free memory in "eden" to allocate the next new object." This is why the Serial collector uses "GC (Allocation Failure)" to label the Minor GC event in the log message. "Allocation Failure" in "eden" triggers the Minor GC.

If you turn on the "-XX:+PrintHeapAtGC" option, you may see different "eden" usage percentages before different Minor GCs.

For example, the following log message shows a Minor GC was triggered when the Serial collector failed to allocate the next new object. At that time, "eden" usage was 94%, which is about 4151K used out of 4416K. In other words, the next new object is larger than 265K (or 4416K-4151K).

{Heap before GC invocations=1 (full 0):
 def new generation   total 4928K, used 4427K [0x04c00000, ...
  eden space 4416K,  94% used [...
  from space 512K,  47% used [...
  to   space 512K,   0% used [...
 
0.104: [GC (Allocation Failure) ...
...

Here is another example. The following log message shows a Minor GC was triggered when the Serial collector failed to allocate the next new object. At that time, "eden" usage was 99%, which is about 69696K used out of 70400K. In other words, the next new object is larger than 704K (or 70400K-69696K).

 def new generation   total 140672K, used 110964K [0x04800000, ...
  eden space 70400K,  99% used [...
  from space 70272K,  58% used [...
  to   space 70272K,   0% used [...

1.093: [GC (Allocation Failure) ...
...

Last update: 2018.

Table of Contents

 About This Book

 Heap Memory Area and Size Control

 JVM Garbage Collection Logging

 Introduction of Garbage Collectors

Serial Collector - "+XX:+UseSerialGC"

 What Is Serial Collector

 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

 Garbage Collection Performance Test Summary

 Outdated Tutorials

 References

 Full Version in PDF/EPUB