Why does G1GC log "humongous allocation request failed"?
Environment
- Java using G1GC
Issue
- We see the following messages in our error log followed by a Full GC:
87080.686: [G1Ergonomics (Heap Sizing) attempt heap expansion, reason: humongous allocation request failed, allocation request: 531476496 bytes]
87080.686: [G1Ergonomics (Heap Sizing) expand the heap, requested expansion amount: 318767104 bytes, attempted expansion amount: 318767104 bytes]
87080.686: [G1Ergonomics (Heap Sizing) did not expand the heap, reason: heap expansion operation failed]
Root Cause
These messages indicate numerous allocation failures for humongous objects (objects in the heap that are larger than 50% of the G1 region size) eventually ending in a Full GC to free up a contiguous set of regions. From the message, we can see that the collector is requesting 531M of contiguous heap regions, but unable to get that requiring a Full GC to compact and rearrange the regions in the heap. Are objects of this side considered normal in the application? Is there a heap dump from the time of the issue that we can take a look at these large objects and try to see if we can reduce their size? If they are considered normal, consider raising the size of -XX:G1HeapRegionSize=16M to try and combat this.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.