Generational Garbage Collection — Young vs Old Generation Explained
Fast recall
Quick revision
Core answer
Whether you understand why generational GC is faster than collecting the whole heap and can explain the Eden/Survivor copy mechanic
Treating Eden and the Survivor spaces as equal in size or thinking objects are immediately promoted to old gen after one GC
Explain how a high allocation rate that overflows the Survivor space causes premature promotion and how to detect it in GC logs
Interview-ready guide
Interview answer
Generational garbage collection is built on a single empirical observation called the weak generational hypothesis: most objects die young. The JVM exploits this by splitting the heap into a young generation, where new objects live briefly, and an old generation for long-lived objects.
Young generation layout:
- Eden (about 80% of young gen) — where every
newallocation lands - Survivor 0 and Survivor 1 (about 10% each) — only one is active at a time; the other stays empty as the copy target
Minor GC mechanics:
- Triggered when Eden fills
- Live objects in Eden and the active Survivor are copied to the empty Survivor
- Eden and the source Survivor are reclaimed in one shot — fast because most of the young gen is dead
- The roles of S0 and S1 swap each cycle
Promotion to old generation:
- Each object has an age in its header, incremented each time it survives a minor GC
- When age hits
-XX:MaxTenuringThreshold(default 15), the object is promoted to old gen - If the Survivor space cannot hold all survivors, they are prematurely promoted to old gen regardless of age — this is the main GC pathology to watch for
Why this design is fast:
- Minor GC cost scales with live data, not Eden size
- Bump-pointer allocation in Eden is faster than
malloc - Old generation is collected far less frequently because it grows slowly
In an interview, I'd emphasize that diagnosing premature promotion with -XX:+PrintTenuringDistribution is more practical knowledge than memorizing the default ratios.
Generational Garbage Collection — Young vs Old Generation Explained
Direct Answer
Generational GC splits the heap into young (Eden + Survivor) and old generations because most objects die young. Minor GC collects only the young generation — fast, frequent pauses. Major/full GC collects the old generation (and often the whole heap) — slower, rarer. Objects survive a configurable number of minor collections (tenuring threshold) before promotion to old.
Common Mistakes & Pitfalls
Treating Eden and the Survivor spaces as equal in size or thinking objects are immediately promoted to old gen after one GC
Check your understanding
Answer these without looking back at the article.
- What is premature promotion and how do you diagnose it from GC logs?
- How does G1GC's region-based heap differ from the traditional Eden/Survivor/Tenured model?
- Why does object pooling often hurt performance with modern garbage collectors?
- What does -XX:+PrintTenuringDistribution show, and how do you interpret it?
Related interview prep categories
2Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.