My Oracle Support Banner

How to Resolve GC Allocation Failure Messages Using G1GC When -Xmx is 4G and Above (Doc ID 2396339.1)

Last updated on OCTOBER 10, 2023

Applies to:

Oracle Knowledge - Version 8.6 and later
Information in this document applies to any platform.
When using Java 1.7 above version 1.7_20 or Java 1.8 and using 4G of memory or more you need to specify the G1GC garbage collector. The G1GC garbage collector has be to turned on with Java versions 1.7 and 1.8. It is on by default in version 1.9 and above.

Goal

What does GC (allocation failure) actually mean?

A GC allocation failure means that the garbage collector could not move objects from young gen to old gen fast enough because it does not have enough memory in old gen.  This can cause application slowness.

A more detailed explanation can be found in this article which is about one of the Java garbage collectors that describes what an Allocation Failure is.
https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/g1_gc.html

Allocation (Evacuation) Failure
As with CMS, the G1 collector runs parts of its collection while the application continues to run and there is a risk that the application will allocate objects faster than the garbage collector can recover free space.  In G1, the failure (exhaustion of the Java heap) occurs while G1 is copying live data out of one region (evacuating) into another region.  The copying is done to compact the live data.  If a free (empty) region cannot be found during the evacuation of a region being garbage collected, then an allocation failure occurs (because there is no space to allocate the live objects from the region being evacuated) and a stop-the-world (STW) full collection is done.  [stop-the-world means that all threads are stopped and therefore no application work is being done]

NOTE: As I read in the documentation, G1GC is more aggressive Garbage collector and sometimes consumes more memory and causes out of memory issues if not used/tuned properly.
 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.