On Wed, 13 Nov 2024 17:19:18 GMT, Kelvin Nilsen <kdnil...@openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request with a new target base due to 
>> a merge or a rebase. The incremental webrev excludes the unrelated changes 
>> brought in by the merge/rebase. The pull request contains four additional 
>> commits since the last revision:
>> 
>>  - Merge branch 'master' into JDK-8343704-cleaner-gc
>>  - Merge branch 'master' into JDK-8343704-cleaner-gc
>>  - Touchups: assert index, polish commits
>>  - Fix
>
> src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 290:
> 
>> 288:                 list.remove(lastIdx);
>> 289: 
>> 290:                 // Capacity control: trim the backing storage if it 
>> looks like
> 
> I think we need to set maxIdx to lastIdx - 1 here.  Otherwise, we'll never 
> trim back the storage.  maxIdx can only increase in insert() as currently 
> implemented.

Right, d'oh. The unavailability of `ArrayList.capacity()` is what gets us in 
this mess. I'll try to rewrite to just plain arrays.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22043#discussion_r1841012953

Reply via email to