liveBook · Manning

Full GC cycle

As explained in Troubleshooting Java, Second Edition

Full garbage collection is a garbage-collection cycle that examines and reclaims objects across the heap rather than only a young-generation region.

A full GC cycle examines and reclaims objects across the heap instead of limiting collection to a young-generation region. Frequent full GCs can create performance problems through repeated pauses and memory-management overhead. section 11.4.1 section 11.4.3

Interpret a full-GC pattern by checking:

  • Pause duration and recurrence: repeated pauses above roughly 50 milliseconds warrant investigation, especially when they create stop-the-world latency spikes. section 11.4.1
  • Heap usage before and after collection: minimal reclamation suggests retained objects or a possible memory leak. section 11.4.1 section 11.5
  • Effective but frequent reclamation: repeated full GCs with peaks and valleys in memory usage usually indicate an under-provisioned heap rather than a leak. section 11.4.3

Reading a full-GC sequence

A log showing repeated full collections such as “8192M->6100M(8192M), 2.345678 secs” demonstrates substantial reclamation but long pauses. If this pattern continues, increasing the heap with -Xmx and -Xms may provide short-term relief; optimizing memory use remains the sustainable response. section 11.4.3

[GC pause (G1 Evacuation Pause) (mixed), 0.01506789 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.01783456 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.02021234 secs]

[Full GC (Allocation Failure) 8192M->6100M(8192M), 2.345678 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.01901234 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.02115678 secs]

[Full GC (Allocation Failure) 8192M->5800M(8192M), 2.678901 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.0987654 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.02254321 secs]

[Full GC (Allocation Failure) 8192M->5600M(8192M), 2.789012 secs]

Compare full-GC pause durations and before-and-after heap sizes to distinguish memory pressure from ineffective reclamation. section 11.4.3

How Troubleshooting Java, Second Edition covers it

How deep it goes
Explains pause duration, event frequency, heap reclamation, and diagnostic patterns, but defers collector internals.
Examples
Uses GC-log sequences showing allocation failures, heap-size changes, pause durations, and recurring full collections.
What it assumes
Assumes basic JVM memory awareness while introducing GC logs, heap utilization, pause times, and leak-versus-capacity reasoning.
What you can do after
Diagnose full-GC pressure with GC logs and choose between leak investigation, heap expansion, and memory-use optimization.
How it connects
Connects full GC with garbage collection, heap memory, memory leaks, GC logs, stop-the-world events, and JVM tuning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Troubleshooting Java, Second Edition. The section links point to the parts of the book it draws on.