RFR: 8222145: ZGC: Introduce SoftMaxHeapSize flag

Per Liden per.liden at oracle.com
Tue Apr 9 09:13:35 UTC 2019


This patch introduces a manageable SoftMaxHeapSize flag. When set, the 
GC should strive to not grow heap size beyond the specified size. But as 
the flag name suggests, this is a soft limit. In other words, the GC is 
allowed to grow the heap size beyond SoftMaxHeapSize if needed.

The SoftMaxHeapSize is not be allowed to be set to a value smaller than 
min heap size (-Xms) or greater than max heap size (-Xmx). When not set 
on the command-line, this flag defaults to the max heap size.

There are a few different use cases where this flag could be useful. For 
example, when you want to keep the heap footprint down, while 
maintaining the capability to deal with a temporary increase in heap 
space requirement. Or when you want to play it safe, with lots of 
margin, to increase confidence that you will not run into an allocation 
stall because of an unforeseen increase in allocation rate.

This flag also fit well with the coming JEP 351: ZGC: Uncommit Unused 
Memory.

Since the flag is manageable, the soft max heap size can be adjusted 
(for example via jcmd VM.set_flag) in a live JVM.

This option is not prefixed with Z, since other GCs will likely use this 
in the future too (at least G1).

Bug: https://bugs.openjdk.java.net/browse/JDK-8222145
Webrev: http://cr.openjdk.java.net/~pliden/8222145/webrev.0

/Per



More information about the hotspot-gc-dev mailing list