-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 15
-
Component/s: hotspot
-
b06
During Remark (and during full gc) we resize the heap according to Min/MaxHeapFreeRatio regardless of that heap size goal (= S_goal).
Given that at Remark G1 heap usage (S_remark) is almost peaked, with the default value of MinHeapFreeRatio of 40% G1 might expand much more or shrink much less than expected. I.e.
(1 + MinHeapFreeRatio) * S_remark >> S_goal
The difference between S_remark and S_goal will with high probability never be used, hence wasted for use by other processes.
This behavior may also lead to unexpected expansion of the heap, see the comment at the end of
The same applies to MaxHeapFreeRatio when deciding to shrink. There may be a huge amount of free regions after a one-time expansion but the goal heap size smaller than that. This is particularly noticeable on large heaps where the absolute amount of free unused space can be very large.
One sub-goal of this change may be removing the use of Min/MaxHeapFreeRatio for G1. To support this, we can change the default values for these flags so that they only affect heap sizing if explicitly set by the user.
Recently a user found an application/benchmark where the use of default values for MaxHeapFreeRatio prevents good throughput, as full gcs force heap shrinking all the time (https://mail.openjdk.org/pipermail/hotspot-jfr-dev/2026-January/008796.html).
- causes
-
JDK-8376051 gc/stress/TestStressG1Uncommit.java fails assertLessThan: expected that xxx < xxx
-
- Resolved
-
-
JDK-8376082 Test gc/stress/TestStressG1Uncommit.java is failing: assertLessThan: expected that 927989760 < 927989760
-
- Closed
-
- csr for
-
JDK-8375300 G1 may waste lots of space or fail to uncommit when observing MinHeapFreeRatio during sizing after full gc
-
- Closed
-
- is blocked by
-
JDK-8248322 G1: Refactor full collection sizing code
-
- Resolved
-
- relates to
-
JDK-6490394 G1: Allow heap shrinking / memory unmapping after reclaiming regions during Remark
-
- Resolved
-
-
JDK-8238687 Investigate memory uncommit during young collections in G1
-
- Resolved
-
-
JDK-8248324 G1: Remove resizing during Remark
-
- Resolved
-
- links to
-
Commit(master)
openjdk/jdk/b1340305
-
Review(master)
openjdk/jdk/29137