Consecutive Full GCs but no OOM

Thomas Schatzl thomas.schatzl at oracle.com
Mon May 14 19:45:55 UTC 2018


Hi,

On Mon, 2018-05-14 at 13:22 -0600, Shawn Heisey wrote:
> On 5/14/2018 11:41 AM, Thomas Schatzl wrote:
> > There is unfortunately no way to get detailed information in a
> > product build about what Hotspot thinks.

To clarify that statement a bit: you need to enable -XX:+Verbose to get
exact information on what Hotspot thinks, but Verbose can only be
changed in debug builds.

In JDK9+ you could use -Xlog:gc+ergo=trace to get this information..

> > However not only gc overhead is accounted for in the decision to
> > give an OOME, but also how much memory the full gcs free.
> > 
> > Probably the most important flag here would be GCHeapFreeLimit:
> > simplified, if free space after full gc is below this percentage of
> > total heap, that full gc does not count against GCOverHeadLimit.
> > 
> > Looking at the log output, after Full GC there is ~4% of max heap
> > available. The default value for GCOverHeadLimit is 2 (percent).
> 
> I have a question sparked by this discussion, but it's only
> indirectly related.
> 
> How long a timeframe is examined to determine whether the 98% and 2%
> thresholds are violated?  This information is not in the
> documentation that I've been able to find.  Here's an example of a
> java 8 documentation link where that information is not shown:
> 
> https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/cm
> s.html#sthref35

  I did not think this is actually documented - I had to look at the
code :)

There is a flag called AdaptiveSizePolicyGCTimeLimitThreshold (default:
5) which defines the amount of consecutive GCs that need to exceed
these thresholds to result in an OOME. That counter is reset at the
first GC not exceeding the thresholds.

I hope this was what you were asking for.

Thanks,
  Thomas


More information about the hotspot-gc-use mailing list