Backend Development 4 min read

When Do Java Objects Move to the Old Generation? Key GC Triggers Explained

This article explains the main conditions that cause Java objects to be promoted from the young generation to the old generation, covering age thresholds, space guarantees, dynamic age determination, and large‑object allocation rules in HotSpot JVM.

Lobster Programming
Lobster Programming
Lobster Programming
When Do Java Objects Move to the Old Generation? Key GC Triggers Explained

1. Age Threshold

In HotSpot JVM each object created in Eden gets an age counter; after each Minor GC that survives, its age increments. When the age reaches the threshold (default 15, configurable via -XX:MaxTenuringThreshold), the object is promoted to the old generation.

2. Space Guarantee

During a Minor GC, if the Survivor space cannot accommodate all surviving objects, the JVM checks whether the old generation has enough contiguous space. If sufficient, those objects are promoted early to the old generation.

If both Survivor and old generation lack space, a Full GC is triggered to compact memory; if after collection there is still insufficient space, an OutOfMemoryError occurs.

3. Dynamic Age Determination

HotSpot also uses dynamic age determination. When a group of objects occupies more than 50 % of the Survivor space (the ratio set by -XX:TargetSurvivorRatio), any object whose age is at least the maximum age among that group is promoted directly, regardless of the static age threshold.

4. Large Objects Directly to Old Generation

Objects that require large contiguous memory (e.g., large strings or arrays) can be allocated directly in the old generation if they exceed the size set by -XX:PretenureSizeThreshold. This avoids their placement in the young generation and reduces Minor GC overhead. The option works only with the Serial and ParNew collectors.

JavaJVMMemory ManagementGarbage CollectionOld Generation
Lobster Programming
Written by

Lobster Programming

Sharing insights on technical analysis and exchange, making life better through technology.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.