RFR: 8328168: Epsilon: Premature OOM when allocating object larger than uncommitted heap size [v3]

Aleksey Shipilev shade at openjdk.org
Mon Mar 18 08:56:28 UTC 2024


On Fri, 15 Mar 2024 05:30:08 GMT, Guoxiong Li <gli at openjdk.org> wrote:

>> src/hotspot/share/gc/epsilon/epsilonHeap.cpp line 129:
>> 
>>> 127:       size_t size_in_bytes = size * HeapWordSize;
>>> 128:       size_t uncommitted_space = max_capacity() - capacity();
>>> 129:       size_t unused_space = max_capacity() - used();
>> 
>> Please also: 
>> 
>> 
>> assert(unused_space <= uncommitted_space, 
>>        "Unused (" SIZE_FORMAT ") <= uncommitted (" SIZE_FORMAT ")",
>>        unused_space, uncommitted_space);
>
> I think it should be `assert(unused_space >= uncommitted_space, ...)`.

Right!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18304#discussion_r1528097493


More information about the hotspot-gc-dev mailing list