RFR: 8267703: runtime/cds/appcds/cacheObject/HeapFragmentationTest.java crashed with OutOfMemory

Kim Barrett kbarrett at openjdk.java.net
Fri May 28 23:32:20 UTC 2021


On Fri, 28 May 2021 08:16:45 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

>> src/hotspot/share/gc/g1/g1FullCollector.cpp line 99:
>> 
>>> 97:   // Finally consider the amount of used regions.
>>> 98:   uint regions_per_worker = (uint) (HeapSizePerGCThread / G1HeapRegionSize);
>>> 99:   uint used_worker_limit = MAX2((heap->num_used_regions() / regions_per_worker), 1u);
>> 
>> I don't see anything that would ensure regions_per_worker can't be zero, which would lead to divide by zero when calculating used_worker_limit.
>
> Good catch, was a bit quick there. But I'm thinking more and more that we should maybe simplify this more to just use, `heap->num_used_regions()` as the limit.

That seems like a reasonable idea to me as well.

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

PR: https://git.openjdk.java.net/jdk/pull/4225



More information about the hotspot-gc-dev mailing list