Skip to content

Commit

Permalink
8336911: ZGC: Division by zero in heuristics after JDK-8332717
Browse files Browse the repository at this point in the history
Reviewed-by: aboldtch, eosterlund
  • Loading branch information
MBaesken committed Oct 16, 2024
1 parent cf5bb12 commit 1cc3223
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/hotspot/share/gc/z/zDirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,19 @@ static double calculate_young_to_old_worker_ratio(const ZDirectorStats& stats) {
const size_t reclaimed_per_old_gc = stats._old_stats._stat_heap._reclaimed_avg;
const double current_young_bytes_freed_per_gc_time = double(reclaimed_per_young_gc) / double(young_gc_time);
const double current_old_bytes_freed_per_gc_time = double(reclaimed_per_old_gc) / double(old_gc_time);

if (current_young_bytes_freed_per_gc_time == 0.0) {
if (current_old_bytes_freed_per_gc_time == 0.0) {
// Neither young nor old collections have reclaimed any memory.
// Give them equal priority.
return 1.0;
}

// Only old collections have reclaimed memory.
// Prioritize old.
return ZOldGCThreads;
}

const double old_vs_young_efficiency_ratio = current_old_bytes_freed_per_gc_time / current_young_bytes_freed_per_gc_time;

return old_vs_young_efficiency_ratio;
Expand Down

0 comments on commit 1cc3223

Please sign in to comment.