Skip to content

Commit b134030

Browse files
committed
8238686: G1 may waste lots of space or fail to uncommit when observing MinHeapFreeRatio during sizing after full gc
Reviewed-by: tschatzl, sjohanss
1 parent 4f87fb5 commit b134030

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/hotspot/share/gc/g1/g1Arguments.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -209,6 +209,17 @@ void G1Arguments::initialize() {
209209
FLAG_SET_DEFAULT(GCTimeRatio, 24);
210210
}
211211

212+
// Do not interfere with GC-Pressure driven heap resizing unless the user
213+
// explicitly sets otherwise. G1 heap sizing should be free to grow or shrink
214+
// the heap based on GC pressure, rather than being forced to satisfy
215+
// MinHeapFreeRatio or MaxHeapFreeRatio defaults that the user did not set.
216+
if (FLAG_IS_DEFAULT(MinHeapFreeRatio)) {
217+
FLAG_SET_DEFAULT(MinHeapFreeRatio, 0);
218+
}
219+
if (FLAG_IS_DEFAULT(MaxHeapFreeRatio)) {
220+
FLAG_SET_DEFAULT(MaxHeapFreeRatio, 100);
221+
}
222+
212223
// Below, we might need to calculate the pause time interval based on
213224
// the pause target. When we do so we are going to give G1 maximum
214225
// flexibility and allow it to do pauses when it needs to. So, we'll

0 commit comments

Comments
 (0)