RFR: 8308854: G1 archive region allocation may expand/shrink the heap above/below -Xms
Ivan Walulya
iwalulya at openjdk.org
Mon May 5 14:02:54 UTC 2025
Hi,
Please review this change to prevent G1 from shrinking the heap below -Xms when deallocating CDS archive regions. This issue is particularly noticeable when -Xms==-Xmx, G1 still uncommits the archive regions thus shrinking the heap below -Xms. In this change, G1 does not uncommit the archive regions in cases where doing so would shrink the heap below the configured -Xms.
This is a temporary fix, we expect a more complete solution to be delivered under [JDK-8326035](https://bugs.openjdk.org/browse/JDK-8326035).
Testing: gha, manual testing as below:
Mainline:
[3.740s][info ][gc,init ] Heap Min Capacity: 150G
[3.740s][info ][gc,init ] Heap Initial Capacity: 150G
[3.740s][info ][gc,init ] Heap Max Capacity: 150G
.
.
[3.749s][debug][gc,ergo,heap] Attempt heap shrinking (CDS archive regions). Total size: 33554432B
.
.
[9.000s][info ][gc ] GC(0) Pause Full (System.gc()) 10728M->140M(153568M) 119.887ms
With patch (No shrinking when -Xms == -Xms):
[3.753s][info ][gc,init ] Heap Min Capacity: 150G
[3.753s][info ][gc,init ] Heap Initial Capacity: 150G
[3.753s][info ][gc,init ] Heap Max Capacity: 150G
.
.
[8.773s][info ][gc ] GC(0) Pause Full (System.gc()) 10687M->140M(153600M) 117.901ms
With patch (Shrinking when -Xms != -Xms):
[3.755s][info ][gc,init ] Heap Min Capacity: 153568M
[3.755s][info ][gc,init ] Heap Initial Capacity: 153568M
[3.755s][info ][gc,init ] Heap Max Capacity: 150G
.
.
[3.764s][debug][gc,ergo,heap] Attempt heap shrinking (CDS archive regions). Total size: 33554432B (1 Regions)
.
.
[8.919s][info ][gc ] GC(0) Pause Full (System.gc()) 10692M->140M(153568M) 125.810ms
-------------
Commit messages:
- init
Changes: https://git.openjdk.org/jdk/pull/25036/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25036&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8308854
Stats: 16 lines in 1 file changed: 11 ins; 1 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/25036.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25036/head:pull/25036
PR: https://git.openjdk.org/jdk/pull/25036
More information about the hotspot-gc-dev
mailing list