Garbage collection
Choosing a collector, tuning G1 and reading the unified GC log without guesswork.
- Choosing a HotSpot garbage collector: Serial, Parallel, G1, ZGC or Shenandoah
What each HotSpot collector optimises for, which one the JVM picks by default and why, the flags that select them, and a practical way to decide based on latency, throughput and footprint.
- Reading GC logs with -Xlog:gc: unified logging from setup to diagnosis
How to enable the JDK's unified GC logging with rotation and useful decorators, how the old PrintGC flags map to -Xlog, how to read G1 pause lines, and which patterns point to an undersized heap, a leak or a pause problem.
- Tuning G1 in production: the few options that matter
How G1 organises the heap into regions and meets a pause-time target, which flags are worth changing (heap size, MaxGCPauseMillis, IHOP, region size), which ones to leave alone, and how to recognise humongous allocations and evacuation failures.


