JDK-8195115 : G1 Old Gen MemoryPool CollectionUsage.used values don't reflect mixed GC results
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8u144,9.0.1,10
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2018-01-15
  • Updated: 2019-05-16
  • Resolved: 2018-06-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 Other
11 b19Fixed openjdk8u212Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The specification for the MemoryPoolMXBean.CollectionUsage says that it "Returns the memory usage after the Java virtual machine most recently expended effort in recycling unused objects in this memory pool." For the two G1 MemoryPools (G1 Young Gen and G1 Old Gen), CollectionUsage.used does not reflect the effect of mixed GCs on G1 Old Gen. For G1 Old Gen, CollectionUsage.used reflects only the effect of a full collection. Reproducer attached.

A fix is to (1) add the G1 Old Gen MemoryPool to the G1 Young Gen GarbageCollector, and (2) inform the latter when a mixed GC occurs so it can save the state of the G1 Old Gen MemoryPool.

At Amazon, we find MemoryPool.CollectionUsage to be a more useful metric than MemoryPool.Usage because the former is a much better measure of long term heap occupancy than the latter.