CSR :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
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.