RFR: 8267703: runtime/cds/appcds/cacheObject/HeapFragmentationTest.java crashed with OutOfMemory

Stefan Johansson sjohanss at openjdk.java.net
Thu May 27 13:11:16 UTC 2021


Please review this change to lower fragmentation when heap usage is low.

**Summary**
The above test case fails because the G1 Full GC fails to compact the single used region below the needed threshold. In this case the region needs to be compacted below region index 400 to be able to fit the large array. The reason this fails is that the full GC uses a lot of parallel workers and if the system is under load it is possible that the worker finding the region to compact hasn't been able to claim any regions low enough in the heap to compact the live objects to.

To fix this we can add a third thing to consider in the code calculating the number of workers to use for a given compaction. So far we only look at keeping the waste down and using the default adaptive calculations. If we also consider how much is used we can get a lower worker count in cases like this and that will make it much more likely to succeed with the compaction. In this case it will guarantee it since there is a single region used, so there will be only one worker and then it will compact the region to the bottom of the heap.

**Testing**
Manual verification that this will cause these collections to only use a single worker. Also currently running some performance regression testing to make sure this doesn't cause any big regressions.

-------------

Commit messages:
 - 8267703: runtime/cds/appcds/cacheObject/HeapFragmentationTest.java crashed with OutOfMemory

Changes: https://git.openjdk.java.net/jdk/pull/4225/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4225&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267703
  Stats: 8 lines in 1 file changed: 5 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4225.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4225/head:pull/4225

PR: https://git.openjdk.java.net/jdk/pull/4225



More information about the hotspot-gc-dev mailing list