Skip to content

Commit

Permalink
8321292: SerialGC: NewSize vs InitialHeapSize check has an off-by-one…
Browse files Browse the repository at this point in the history
… error

Reviewed-by: ayang, iwalulya
  • Loading branch information
Thomas Schatzl committed May 27, 2024
1 parent 16dba04 commit a083364
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/hotspot/share/gc/shared/genArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ void GenArguments::initialize_heap_flags_and_sizes() {

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

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

1 comment on commit a083364

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.