Profile Image
PiPi

In the G1 garbage collector, why does a full GC sometimes succeed and sometimes fail?

As shown in the following figure,

an Out-Of-Memory (OOM) error occurred during the last full garbage collection (GC) process.

I would like to ask, why is it that sometimes G1 GC is able to successfully perform a full GC, while at other times it results in an OOM error?

  • g1gc

Please Sign In or to post your comment or answer

Profile Image

Unni Mana

Hi PiPi,

 

There can be several reasons:

Promotion Rates

GC Configuration

Old Generation Size: G1 divides the heap into regions and manages both young and old generations. If the old generation is too full and cannot accommodate new objects being promoted from the young generation, a full GC might not succeed in reclaiming sufficient space.

 

 

Profile Image

PiPi

Hi Unni Mana,

In my scenario, before the last full GC failure, there was a young GC, and it showed that both Eden and Survivors were occupied by 0. Can it be ruled out that the full GC failure was caused by objects being promoted from the young generation?

 

If this reason is ruled out, what else could cause the full GC to fail?

 

 

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • g1gc