RFR: 8377561: ParallelGC in JDK26-ea intermittently fails to expand heap, causing Full GC storm on macOS

Albert Mingkun Yang ayang at openjdk.org
Wed Feb 11 14:06:09 UTC 2026


`ParallelScavengeHeap::should_alloc_in_eden` uses the current eden-capacity to decide whether an allocation should be in eden and the same criteria is also used to decide whether we should run young/full gc to satisfy a failed allocations. When the young-gen/eden-size is relatively small (due to initial heap being small or heap has shrunk), the use of the current eden-capacity can cause full-gc, instead of young-gc, to run, as shown in the attached bm in this bug (https://bugs.openjdk.org/browse/JDK-8377561).

Use "max" eden capacity as the calculation basis so that the threshold is more resilient to heap resizing.

The attached bm runs thousands of full-gc before the fix but zero full-gc after the fix.

Test: tier1-5

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

Commit messages:
 - pgc-young-gen-alloc-threshold

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

PR: https://git.openjdk.org/jdk/pull/29673


More information about the hotspot-gc-dev mailing list