A Guide to OpenJDK HotSpot Garbage Collection
summary
OpenJDK HotSpot uses generational heaps: fast allocation via thread-local allocation buffers and young collections that always copy the entire young area; pause time is dominated by copying cost while GC overhead follows allocation and promotion rates. Parallel Old (throughput) does full mark-sweep-compact, CMS does concurrent marking with no compaction and falls back to single-threaded serial GC on failures, and G1 adds concurrent marking plus mixed collections (partial/incremental compaction). Use GC logs, heap dumps, jvisualvm/JMC and plotting to spot leaks (example: app using ~48GB with <24GB heap → JNI leak) and size generations to allocation/promotion rates.
AI-written summary · about
chapters (19)
- 0:00Introduction to HotSpot GC
- 1:29Performance engineering basics
- 5:24JVM components overview
- 7:11Throughput vs latency design
- 11:46Generational GC explained
- 12:29Allocation with TLABs
- 13:56Young generation reclamation
- 15:19Old generation algorithms
- 18:34CMS no compaction details
- 20:27Serial GC fallback
- 20:47Memory leaks and GC limits
- 21:52Root set and leak causes
- 22:33Tools for leak detection
- 25:03Tuning for throughput and latency
- 28:11Traditional Java Heap
- 28:33G1 GC regionalized Heap
- 30:38G1 GC concurrent marking
- 33:07G1 mixed collections
- 34:35Summary and Q&A
