Skip to content

Commit 8abb9f5

Browse files
committedJul 1, 2023
8047998: Abort the vm if MaxNewSize is not the same as NewSize when MaxHeapSize is the same as InitialHeapSize
Reviewed-by: ayang, tschatzl
1 parent d2e1159 commit 8abb9f5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,13 @@ void GenArguments::initialize_size_info() {
240240
size_t initial_young_size = NewSize;
241241

242242
if (MaxHeapSize == InitialHeapSize) {
243-
// The maximum and initial heap sizes are the same so the generation's
244-
// initial size must be the same as it maximum size. Use NewSize as the
245-
// size if set on command line.
243+
// The maximum and initial heap sizes are the same, so the generation's
244+
// initial size must be the same as its maximum size.
245+
if (FLAG_IS_CMDLINE(NewSize) && FLAG_IS_CMDLINE(MaxNewSize) && NewSize != MaxNewSize) {
246+
vm_exit_during_initialization(
247+
"The MaxNewSize must be the same as NewSize because the MaxHeapSize and InitialHeapSize are the same.");
248+
}
249+
// Use NewSize as the size if it is set on command line.
246250
max_young_size = FLAG_IS_CMDLINE(NewSize) ? NewSize : max_young_size;
247251
initial_young_size = max_young_size;
248252

0 commit comments

Comments
 (0)
Please sign in to comment.