RFR: 8260044: Parallel GC: Concurrent allocation after heap expansion may cause unnecessary full gc [v2]

Kim Barrett kbarrett at openjdk.java.net
Sat Jan 30 06:09:02 UTC 2021


On Fri, 29 Jan 2021 12:55:53 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> src/hotspot/share/gc/parallel/psOldGen.cpp line 192:
>> 
>>> 190: bool PSOldGen::expand(size_t bytes) {
>>> 191:   if (bytes == 0) {
>>> 192:     return true;
>> 
>> I'd prefer if the code would `guarantee` or at least `assert` that `bytes > 0` because returning `true` here seems scary wrt to the loop.
>> 
>> All code paths seem to cover this situation already, i.e. with `word_size == 0` this should not be called.
>> 
>> But if you think it's not a big issue, we can keep it. This is pre-existing of course.
>
> Good point.  I will make sure a 0 size never gets here and assert/guarantee, or otherwise figure out what to do.

I've changed various quick returns on zero size to instead be asserts, since none of them should ever be called with a zero size.

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

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



More information about the hotspot-gc-dev mailing list