Fix Version/s: 12
Compatibility Risk Description:By default the feature is turned off. If enabled, the change causes regular concurrent garbage collection cycles at large intervals during application inactivity. This may cause very minor throughput regressions due to unexpected garbage collections.
Interface Kind:add/remove/modify command line option
Introduce controls for a periodic garbage collection and optional system idle detection to allow giving back of unused memory for the G1 garbage collector for JEP JDK-8204089 Promptly Return Unused Committed Memory from G1.
At the moment G1 will never automatically gives back Java heap memory to the operating system if the application is inactive.
This CSR introduces control options for periodic concurrent garbage collections. I.e. when and how these periodic garbage collections to reclaim memory should occur.
This includes the option
G1PeriodicGCInterval to determine the polling interval,
G1PeriodicGCSystemLoadThreshold to optionally take system load into account, and
G1PeriodicGCInvokesConcurrent to determine the type of garbage collection to occur.
This set of options has been found appropriate for this change after discussion on the hotspot-gc-dev mailing list, most recently in the thread at http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2018-September/023197.html.
Alternatives are discussed in the associated JEP-JDK-8204089: Promptly Return Unused Committed Memory from G1. More, earlier discussion links are available in the comments section of that issue.
manageable(uintx, G1PeriodicGCInterval, 0, \ "Number of milliseconds after a previous GC to wait before " \ "triggering a periodic gc. A value of zero disables periodically "\ "enforced gc cycles.") \ range(0, max_jlong) \ \ product(bool, G1PeriodicGCInvokesConcurrent, true, \ "Determines the kind of periodic GC. Set to true to have G1 " \ "perform a concurrent GC as periodic GC, otherwise use a STW " \ "Full GC.") \ \ manageable(uintx, G1PeriodicGCSystemLoadThreshold, 0, \ "Maximum recent system wide system load as returned by the 1m " \ "value of getloadavg() at which G1 triggers a periodic GC. A " \ "load above this value cancels a given periodic GC. A value of " \ "zero disables this check.") \