RFR: 8339648: ZGC: Division by zero in rule_major_allocation_rate [v2]
Axel Boldt-Christmas
aboldtch at openjdk.org
Fri Sep 13 09:03:09 UTC 2024
On Fri, 13 Sep 2024 08:31:43 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Adjust division following suggestion by xmas
>
> src/hotspot/share/gc/z/zDirector.cpp line 490:
>
>> 488:
>> 489: // Calculate the GC cost for each reclaimed byte
>> 490: const double current_young_gc_time_per_bytes_freed = double(young_gc_time) / double(reclaimed_per_young_gc);
>
> Could this division have the same issue?
Yes, it could if no memory has been reclaimed at all (since the VM started). Similar issues would occur in the call to `calculate_extra_young_gc_time` below. And there I think the problem is even worse, because we might end up with `inf - inf == -nan`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20888#discussion_r1758476392
More information about the hotspot-gc-dev
mailing list