Java / Java 17 Garbage Collection Interview Questions
What is the old (tenured) generation in the JVM heap?
The old generation holds objects that have survived enough minor GC cycles to be promoted out of the young generation - typically long-lived caches, singletons, and other data that outlives many request or task lifecycles.
Because it usually makes up the bulk of the heap and tends to hold a much higher percentage of live data than Eden does, collecting it is more expensive: a full scan and compaction of the old generation touches far more live objects than a young-only collection.
Collectors handle this differently - Parallel and Serial GC compact it in a stop-the-world pause, while G1 reclaims it incrementally through mixed collections, and ZGC/Shenandoah relocate it mostly concurrently to avoid long pauses.
More Related questions...