We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d3abf01 commit a87bc7eCopy full SHA for a87bc7e
src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp
@@ -198,6 +198,14 @@ size_t G1HeapSizingPolicy::young_collection_expansion_amount() {
198
}
199
200
static size_t target_heap_capacity(size_t used_bytes, uintx free_ratio) {
201
+ assert(free_ratio <= 100, "precondition");
202
+ if (free_ratio == 100) {
203
+ // If 100 then below calculations will divide by zero and return min of
204
+ // resulting infinity and MaxHeapSize. Avoid issues of UB vs is_iec559
205
+ // and ubsan warnings, and just immediately return MaxHeapSize.
206
+ return MaxHeapSize;
207
+ }
208
+
209
const double desired_free_percentage = (double) free_ratio / 100.0;
210
const double desired_used_percentage = 1.0 - desired_free_percentage;
211
0 commit comments