1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -276,6 +276,9 @@ void GenArguments::initialize_size_info() {
276
276
// and maximum heap size since no explicit flags exist
277
277
// for setting the old generation maximum.
278
278
MaxOldSize = MAX2 (MaxHeapSize - max_young_size, GenAlignment);
279
+ MinOldSize = MIN3 (MaxOldSize,
280
+ InitialHeapSize - initial_young_size,
281
+ MinHeapSize - MinNewSize);
279
282
280
283
size_t initial_old_size = OldSize;
281
284
@@ -287,9 +290,8 @@ void GenArguments::initialize_size_info() {
287
290
// with the overall heap size). In either case make
288
291
// the minimum, maximum and initial sizes consistent
289
292
// with the young sizes and the overall heap sizes.
290
- MinOldSize = GenAlignment;
291
293
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.
293
295
} else {
294
296
// OldSize has been explicitly set on the command line. Use it
295
297
// for the initial size but make sure the minimum allow a young
@@ -304,9 +306,10 @@ void GenArguments::initialize_size_info() {
304
306
" , -XX:OldSize flag is being ignored" ,
305
307
MaxHeapSize);
306
308
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;
307
312
}
308
-
309
- MinOldSize = MIN2 (initial_old_size, MinHeapSize - MinNewSize);
310
313
}
311
314
312
315
// The initial generation sizes should match the initial heap size,
0 commit comments