diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp index 3ec42478282..144773908ca 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp @@ -349,10 +349,7 @@ void ShenandoahAdaptiveHeuristics::adjust_spike_threshold(double amount) { } size_t ShenandoahAdaptiveHeuristics::min_free_threshold() { - // Note that soft_max_capacity() / 100 * min_free_threshold is smaller than max_capacity() / 100 * min_free_threshold. - // We want to behave conservatively here, so use max_capacity(). By returning a larger value, we cause the GC to - // trigger when the remaining amount of free shrinks below the larger threshold. - return _space_info->max_capacity() / 100 * ShenandoahMinFreeThreshold; + return ShenandoahHeap::heap()->soft_max_capacity() / 100 * ShenandoahMinFreeThreshold; } ShenandoahAllocationRate::ShenandoahAllocationRate() : diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp index b8d85de0487..4e12b1d41e8 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp @@ -53,7 +53,7 @@ void ShenandoahGlobalHeuristics::choose_global_collection_set(ShenandoahCollecti size_t cur_young_garbage) const { auto heap = ShenandoahGenerationalHeap::heap(); size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); - size_t capacity = heap->young_generation()->max_capacity(); + size_t capacity = heap->soft_max_capacity(); size_t garbage_threshold = region_size_bytes * ShenandoahGarbageThreshold / 100; size_t ignore_threshold = region_size_bytes * ShenandoahIgnoreGarbageThreshold / 100; const uint tenuring_threshold = heap->age_census()->tenuring_threshold(); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp index 3aca436104b..fbb165858dc 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp @@ -66,7 +66,7 @@ void ShenandoahYoungHeuristics::choose_young_collection_set(ShenandoahCollection auto heap = ShenandoahGenerationalHeap::heap(); - size_t capacity = heap->young_generation()->max_capacity(); + size_t capacity = heap->soft_max_capacity(); size_t garbage_threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100; size_t ignore_threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahIgnoreGarbageThreshold / 100; const uint tenuring_threshold = heap->age_census()->tenuring_threshold(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp index 099a2c57244..dc666a34c59 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp @@ -64,7 +64,7 @@ bool ShenandoahMetricsSnapshot::is_good_progress(ShenandoahGeneration* generatio // ShenandoahCriticalFreeThreshold is expressed as a percentage. We multiple this percentage by 1/100th // of the generation capacity to determine whether the available memory within the generation exceeds the // critical threshold. - size_t free_expected = (generation->max_capacity() / 100) * ShenandoahCriticalFreeThreshold; + size_t free_expected = (ShenandoahHeap::heap()->soft_max_capacity() / 100) * ShenandoahCriticalFreeThreshold; bool prog_free = free_actual >= free_expected; log_info(gc, ergo)("%s progress for free space: %zu%s, need %zu%s",