Skip to content

Commit a083364

Browse files
author
Thomas Schatzl
committedMay 27, 2024
8321292: SerialGC: NewSize vs InitialHeapSize check has an off-by-one error
Reviewed-by: ayang, iwalulya
1 parent 16dba04 commit a083364

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,11 @@ void GenArguments::initialize_heap_flags_and_sizes() {
101101

102102
// Make sure NewSize allows an old generation to fit even if set on the command line
103103
if (FLAG_IS_CMDLINE(NewSize) && NewSize >= InitialHeapSize) {
104-
log_warning(gc, ergo)("NewSize was set larger than initial heap size, will use initial heap size.");
105-
FLAG_SET_ERGO(NewSize, bound_minus_alignment(NewSize, InitialHeapSize, GenAlignment));
104+
size_t revised_new_size = bound_minus_alignment(NewSize, InitialHeapSize, GenAlignment);
105+
log_warning(gc, ergo)("NewSize (%zuk) is equal to or greater than initial heap size (%zuk). A new "
106+
"NewSize of %zuk will be used to accomodate an old generation.",
107+
NewSize/K, InitialHeapSize/K, revised_new_size/K);
108+
FLAG_SET_ERGO(NewSize, revised_new_size);
106109
}
107110

108111
// Now take the actual NewSize into account. We will silently increase NewSize

0 commit comments

Comments
 (0)