Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
/ jdk22u Public archive

Commit

Permalink
8329223: Parallel: Parallel GC resizes heap even if -Xms = -Xmx
Browse files Browse the repository at this point in the history
Backport-of: aca1e8365bf0f64bf18caf798bbca1d25b3c4117
  • Loading branch information
zhengyu123 committed May 16, 2024
1 parent 5177264 commit 9e3344e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/hotspot/share/gc/shared/genArguments.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -276,6 +276,9 @@ void GenArguments::initialize_size_info() {
// and maximum heap size since no explicit flags exist
// for setting the old generation maximum.
MaxOldSize = MAX2(MaxHeapSize - max_young_size, GenAlignment);
MinOldSize = MIN3(MaxOldSize,
InitialHeapSize - initial_young_size,
MinHeapSize - MinNewSize);

size_t initial_old_size = OldSize;

Expand All @@ -287,9 +290,8 @@ void GenArguments::initialize_size_info() {
// with the overall heap size). In either case make
// the minimum, maximum and initial sizes consistent
// with the young sizes and the overall heap sizes.
MinOldSize = GenAlignment;
initial_old_size = clamp(InitialHeapSize - initial_young_size, MinOldSize, MaxOldSize);
// MaxOldSize has already been made consistent above.
// MaxOldSize and MinOldSize have already been made consistent above.
} else {
// OldSize has been explicitly set on the command line. Use it
// for the initial size but make sure the minimum allow a young
Expand All @@ -304,9 +306,10 @@ void GenArguments::initialize_size_info() {
", -XX:OldSize flag is being ignored",
MaxHeapSize);
initial_old_size = MaxOldSize;
} else if (initial_old_size < MinOldSize) {
log_warning(gc, ergo)("Inconsistency between initial old size and minimum old size");
MinOldSize = initial_old_size;
}

MinOldSize = MIN2(initial_old_size, MinHeapSize - MinNewSize);
}

// The initial generation sizes should match the initial heap size,
Expand Down

1 comment on commit 9e3344e

@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.