RFR: 8345374: Ubsan: runtime error: division by zeroavoid divide by zero

Julian Waters jwaters at openjdk.org
Mon Dec 30 05:23:34 UTC 2024


On Mon, 30 Dec 2024 01:07:44 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this change to G1HeapSizingPolicy to avoid a float division by
> zero when calculating the maximum desired capacity with a MaxHeapFreeRatio
> value of 100%.
> 
> Testing: mach5 tier1 with G1 and MaxHeapFreeRatio=100.

src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp line 201:

> 199: 
> 200: static size_t target_heap_capacity(size_t used_bytes, uintx free_ratio) {
> 201:   assert(free_ratio <= 100, "precondition");

Doesn't debug.hpp have precond for this?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22893#discussion_r1899279856


More information about the hotspot-gc-dev mailing list