Skip to content

Commit 4b1d95c

Browse files
author
Ben Taylor
committedMay 23, 2024
8329223: Parallel: Parallel GC resizes heap even if -Xms = -Xmx
Backport-of: aca1e8365bf0f64bf18caf798bbca1d25b3c4117
1 parent d986096 commit 4b1d95c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed
 

‎src/hotspot/share/gc/shared/genArguments.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -276,6 +276,9 @@ void GenArguments::initialize_size_info() {
276276
// and maximum heap size since no explicit flags exist
277277
// for setting the old generation maximum.
278278
MaxOldSize = MAX2(MaxHeapSize - max_young_size, GenAlignment);
279+
MinOldSize = MIN3(MaxOldSize,
280+
InitialHeapSize - initial_young_size,
281+
MinHeapSize - MinNewSize);
279282

280283
size_t initial_old_size = OldSize;
281284

@@ -287,9 +290,8 @@ void GenArguments::initialize_size_info() {
287290
// with the overall heap size). In either case make
288291
// the minimum, maximum and initial sizes consistent
289292
// with the young sizes and the overall heap sizes.
290-
MinOldSize = GenAlignment;
291293
initial_old_size = clamp(InitialHeapSize - initial_young_size, MinOldSize, MaxOldSize);
292-
// MaxOldSize has already been made consistent above.
294+
// MaxOldSize and MinOldSize have already been made consistent above.
293295
} else {
294296
// OldSize has been explicitly set on the command line. Use it
295297
// for the initial size but make sure the minimum allow a young
@@ -304,9 +306,10 @@ void GenArguments::initialize_size_info() {
304306
", -XX:OldSize flag is being ignored",
305307
MaxHeapSize);
306308
initial_old_size = MaxOldSize;
309+
} else if (initial_old_size < MinOldSize) {
310+
log_warning(gc, ergo)("Inconsistency between initial old size and minimum old size");
311+
MinOldSize = initial_old_size;
307312
}
308-
309-
MinOldSize = MIN2(initial_old_size, MinHeapSize - MinNewSize);
310313
}
311314

312315
// The initial generation sizes should match the initial heap size,

0 commit comments

Comments
 (0)