RFR: 8218733: SA: CollectedHeap provides broken implementation for used() and capacity()

Stefan Karlsson stefan.karlsson at oracle.com
Mon Feb 11 08:13:47 UTC 2019


Hi all,

Please review this patch to remove the broken implementation of 
CollectedHeap used() and capacity() and instead force all GCs to provide 
their own implementations.

https://cr.openjdk.java.net/~stefank/8218733/webrev.01/
https://bugs.openjdk.java.net/browse/JDK-8218733

This was found while running 
serviceability/sa/TestHeapDumpForLargeArray.java on an experimental 
implementation of heap dumping in ZGC.

ZGC didn't provide a ZCollectedHeap.used() function and 
CollectedHeap.used() was used instead at:
         // Check weather we should dump the heap as segments
         useSegmentedHeapDump = vm.getUniverse().heap().used() > 
HPROF_SEGMENTED_HEAP_DUMP_THRESHOLD;

Because of this we incorrectly did not use segmented heap dumps, and 
therefore overflowed later in the code

Aleksey and Roman,

Could you verify that the implementation for Epsilon is correct? I also 
haven't implemented capacity for Shenandoah, as the information isn't 
trivially available in the ShenandoahHeap SA class. Do you want to fix 
it as part of this patch, or should I create a separate RFE for Shenandoah?

Thanks,
StefanK


More information about the serviceability-dev mailing list