Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8195115

G1 Old Gen MemoryPool CollectionUsage.used values don't reflect mixed GC results


    • Type: Bug
    • Status: In Progress
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u144, 9.0.1, 10
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
    • OS:


      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.
      1. GcTest.java
        1 kB
        Paul Hohensee
      2. org.tar.gz
        350 kB
        Paul Hohensee

        Issue Links


          There are no comments yet on this issue.


            • Assignee:
              phh Paul Hohensee
              phh Paul Hohensee
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: