Hello PiPi,
Greetings!
In general, objects in the Eden area may directly promote to the Old generation due to memory pressure, insufficient space in Survivor spaces, large object allocations, or JVM garbage collection tuning.
Insufficient Space in Survivor Spaces:
In a normal scenario, when a young generation garbage collection (Minor GC) occurs, objects in the Eden space that are still alive are moved to one of the two Survivor spaces (S0 or S1). However, if both Survivor spaces are full or lack sufficient space, objects will be promoted directly to the Old generation, even if they haven't lived long enough.
Large object allocations:
Some objects are too large to fit in the Eden space or the Survivor spaces. These large objects are directly allocated in the Old generation to avoid fragmentation or inefficient memory usage.
Full GC Pressure:
If the Old generation is fragmented or nearly full, the JVM might trigger more aggressive promotions from the Eden space to avoid frequent Full GCs, which are expensive. In this scenario, objects that are still relatively young can be moved to the Old generation to free up space in the Young generation.
Thanks.
Edit your Comment