Skip to content

Commit

Permalink
8328744: Parallel: Parallel GC throws OOM before heap is fully expanded
Browse files Browse the repository at this point in the history
Backport-of: bf8146eac24ba8e00d1794ef7134ecf2476cf897
  • Loading branch information
zhengyu123 committed May 2, 2024
1 parent 87d5da4 commit a4d8d06
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/hotspot/share/gc/parallel/psScavenge.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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 @@ -708,12 +708,14 @@ bool PSScavenge::should_attempt_scavenge() {

size_t avg_promoted = (size_t) policy->padded_average_promoted_in_bytes();
size_t promotion_estimate = MIN2(avg_promoted, young_gen->used_in_bytes());
bool result = promotion_estimate < old_gen->free_in_bytes();
// Total free size after possible old gen expansion
size_t free_in_old_gen = old_gen->max_gen_size() - old_gen->used_in_bytes();
bool result = promotion_estimate < free_in_old_gen;

log_trace(ergo)("%s scavenge: average_promoted " SIZE_FORMAT " padded_average_promoted " SIZE_FORMAT " free in old gen " SIZE_FORMAT,
result ? "Do" : "Skip", (size_t) policy->average_promoted_in_bytes(),
(size_t) policy->padded_average_promoted_in_bytes(),
old_gen->free_in_bytes());
free_in_old_gen);
if (young_gen->used_in_bytes() < (size_t) policy->padded_average_promoted_in_bytes()) {
log_trace(ergo)(" padded_promoted_average is greater than maximum promotion = " SIZE_FORMAT, young_gen->used_in_bytes());
}
Expand Down

1 comment on commit a4d8d06

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