When the G1 ergo decision output is enabled, it reports a message when a region allocation fails. Unfortunately, when an evacuation failure happens during a GC, a region allocation is attempted for every object that cannot be moved which means that we will get a "region allocation failed" message for each object that cannot be moved, which could be 1,000s, 10,000s, etc. This is what the output looks like:
211.693: [G1Ergonomics (CSet Construction) add young regions to CSet, eden: 154 regions, survivors: 16 regions, predicted young region time: 163.01 ms]
211.693: [G1Ergonomics (CSet Construction) finish choosing CSet, eden: 154 regions, survivors: 16 regions, old: 0 regions, predicted pause time: 205.73 ms, target pause time: 200.00 ms]
211.775: [G1Ergonomics (Heap Sizing) attempt heap expansion, reason: region allocation request failed, allocation request: 16384 bytes]
211.775: [G1Ergonomics (Heap Sizing) expand the heap, requested expansion amount: 16384 bytes, attempted expansion amount: 1048576 bytes]
211.775: [G1Ergonomics (Heap Sizing) did not expand the heap, reason: heap expansion operation failed]
211.775: [G1Ergonomics (Heap Sizing) attempt heap expansion, reason: region allocation request failed, allocation request: 16384 bytes]
211.776: [G1Ergonomics (Heap Sizing) expand the heap, requested expansion amount: 16384 bytes, attempted expansion amount: 1048576 bytes]
211.776: [G1Ergonomics (Heap Sizing) did not expand the heap, reason: heap expansion operation failed]
211.776: [G1Ergonomics (Heap Sizing) attempt heap expansion, reason: region allocation request failed, allocation request: 16384 bytes]
211.776: [G1Ergonomics (Heap Sizing) expand the heap, requested expansion amount: 16384 bytes, attempted expansion amount: 1048576 bytes]
...
We should make sure we do not overwhelm the log with such excessive output.
(thanks to David Vengerov for bringing this up)