Introduction of Garbage Collectors
This chapter provides tutorial notes and example codes on garbage collectors. Topics include JVM memory management summary; Introduction of Generational Garbage Collector; Young and Tenured Heap regions; Eden and Survivor spaces; Mark-Sweep-Compact algorithm; Garbage collector variations.
JVM Memory Manager - Garbage Collector
Generational Garbage Collection in HotSpot
Young Generation Collection - Minor GC
Young Generation Collectors - Serial, PS, ParNew, G1
Tenured Generation Collection - Major GC
Tenured Generation Collectors - Serial, ParOldGen, CMS, G1
Collector Combinations: Serial, Parallel, Concurrent, G1
- HotSpot JVM Heap area is divided into 2 generations: Young Generation and Tenured (Old) Generation.
- The Young Generation is divided into 3 areas: Eden, Survivor Space 'From' and Survivor Space 'To'.
- When the Eden area is full, a Minor Garbage Collection (GC) is performed, which moves live objects
from the Eden area to the Survivor Space 'To' area. It also empties the Survivor Space 'From' area
by moving "young" live objects to the Survivor Space 'To' area and promoting "old" live objects to the Tenured Generation.
- When the Tenured Generation is full, a Full Garbage Collection (GC) is performed, which
follows a 3-step, Mark-Sweep-Compact (MSC), process to deallocate dead objects and defragment free space.
- There are 5 variations of garbage collectors used in HotSpot JVM:
The Serial Collector, The Parallel Collector, The Parallel Compaction Collector,
The Concurrent Mark-Sweep (CMS) Collector, and The Garbage First (G1) Collector.
Table of Contents
About This Book
Heap Memory Area and Size Control
JVM Garbage Collection Logging
►Introduction of Garbage Collectors
Serial Collector - "+XX:+UseSerialGC"
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
Full Version in PDF/EPUB