Java / JVM Architecture (Java21) Interview questions
What is the difference between Young Generation and Old Generation in heap memory?
The heap is split generationally based on how long objects tend to live, which lets the collector treat them differently.
| Young Generation | Old (Tenured) Generation |
| Holds newly created objects (Eden + two Survivor spaces) | Holds objects that survived enough Young GC cycles |
| Collected frequently via cheap Minor GC | Collected less often, via costlier Major/Full GC |
| Most objects here die quickly and never get promoted | Objects here tend to be long-lived (caches, singletons, live data structures) |
An object is promoted ("tenured") from Young to Old once its age, the number of Minor GC cycles it has survived, crosses a threshold tunable via -XX:MaxTenuringThreshold, or when a Survivor space fills up.
More Related questions...