Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8352765: G1CollectedHeap::expand_and_allocate() may fail to allocate even after heap expansion succeeds #24257

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/hotspot/share/gc/g1/g1Policy.cpp
Original file line number Diff line number Diff line change
@@ -340,8 +340,9 @@ uint G1Policy::calculate_young_target_length(uint desired_young_length) const {
_reserve_regions,
max_to_eat_into_reserve);

uint desired_eden_length = desired_young_length - _g1h->survivor_regions_count();
uint allocated_eden_length = allocated_young_length - _g1h->survivor_regions_count();
uint survivor_regions_count = _g1h->survivor_regions_count();
uint desired_eden_length = desired_young_length - survivor_regions_count;
uint allocated_eden_length = allocated_young_length - survivor_regions_count;

if (_free_regions_at_end_of_collection <= _reserve_regions) {
// Fully eat (or already eating) into the reserve, hand back at most absolute_min_length regions.
@@ -356,9 +357,8 @@ uint G1Policy::calculate_young_target_length(uint desired_young_length) const {
receiving_eden - allocated_eden_length : 0;

log_trace(gc, ergo, heap)("Young target length: Fully eat into reserve "
"receiving young %u receiving additional eden %u",
receiving_eden,
receiving_additional_eden);
"receiving eden %u receiving additional eden %u",
receiving_eden, receiving_additional_eden);
} else if (_free_regions_at_end_of_collection < (desired_eden_length + _reserve_regions)) {
// Partially eat into the reserve, at most max_to_eat_into_reserve regions.
uint free_outside_reserve = _free_regions_at_end_of_collection - _reserve_regions;
@@ -377,7 +377,7 @@ uint G1Policy::calculate_young_target_length(uint desired_young_length) const {
log_trace(gc, ergo, heap)("Young target length: Partially eat into reserve "
"free outside reserve %u "
"receiving within reserve %u "
"receiving young %u "
"receiving eden %u "
"receiving additional eden %u",
free_outside_reserve, receiving_within_reserve,
receiving_eden, receiving_additional_eden);
Copy link
Contributor

Choose a reason for hiding this comment

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

Log message needs update.