RFR: 8344332: (bf) Migrate DirectByteBuffer to use java.lang.ref.Cleaner [v9]
Aleksey Shipilev
shade at openjdk.org
Fri Jan 24 07:09:51 UTC 2025
On Fri, 24 Jan 2025 00:09:00 GMT, Brent Christian <bchristi at openjdk.org> wrote:
>> Aleksey Shipilev has updated the pull request incrementally with three additional commits since the last revision:
>>
>> - No instantiation for BufferCleaner, javadocs
>> - Remove hasReferencePendingList
>> - Revert test exclusion, moved to JDK-8348301
>
> src/java.base/share/classes/java/nio/Bits.java line 151:
>
>> 149: // Trigger GC to perform reference processing and then cleaning.
>> 150: canary = BufferCleaner.newCanary();
>> 151: System.gc();
>
> So the Canary functions only to avoid calling `System.gc()` again if we've not yet seen progress from the previous call to `System.gc()`. Is that right?
Yes. There is no point in flooding the JVM with GC requests if Cleaner have not responded yet. It is, by nature, similar to the waiting for pending reference processing hack we had before.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22165#discussion_r1928186438
More information about the core-libs-dev
mailing list