"Allocated < Usage" problem in G1 log

Thomas Schatzl thomas.schatzl at oracle.com
Fri Apr 13 07:35:38 UTC 2018


Hi,

On Fri, 2018-04-13 at 10:49 +0800, Lijie Xu wrote:
> Hi all,
> 
> I currently found a "allocated < usage" problem in the G1 log as
> follows.
> 
>    [Eden: 342.0M(3296.0M)->0.0B(3890.0M) Survivors: 1024.0K->1024.0K
> Heap: 5541.2M(6655.0M)->1886.0M(6655.0M)]
>  [Times: user=0.03 sys=0.00, real=0.02 secs] 
> 
> This log reveals that 
> (1) The allocated space of "Old+Humongous" is (5541.2 - 342) =
> 5199.2MB before GC. 
> (2) The usage of "Old+Humongous" is (6655 - 3296)=3359MB before GC.
> (3) The usage of "Old+Humongous" > the allocated space of
> "Old+Humongous" (Wrong)
> 
> There may be a bug in the GC statistics profiler.

  due to fragmentation (holes) within the heap where G1 can not
allocate into, the usage (inverse of the space G1 can actually allocate
into) can be higher than what is actually allocated (i.e. live
objects).

This may also explain the premature garbage collection, i.e. where Eden
is much smaller than expected before GC (there are other reasons,
including bugs, but without more detailed log output you can't tell).

A frequent cause for this can be humongous objects. Consider increasing
heap region size in this case (it seems to be 2M on your heap right
now), to 4M or even 8M. Use -XX:G1HeapRegionSize=xx to do this.

Thanks,
  Thomas



More information about the hotspot-gc-use mailing list