On Thu, 21 Nov 2024 05:42:09 GMT, Brent Christian <bchri...@openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Check all elements are removable after random test
>
> test/micro/org/openjdk/bench/java/lang/ref/CleanerGC.java line 45:
> 
>> 43: 
>> 44:     // Deliberately a linked list to avoid exposing external parallelism 
>> to GC.
>> 45:     Target prev;
> 
> Is `CleanerGC.prev` used?

Yes. It maintains the root of a reachable linked list of `Target`-s.

> test/micro/org/openjdk/bench/java/lang/ref/CleanerGC.java line 57:
> 
>> 55:     @Benchmark
>> 56:     public void test() {
>> 57:         System.gc();
> 
> How confident are we that most/all/(any?) `Target` objects are being 
> collected?

The point of this test is not collecting `Target`-s -- they are all reachable. 
The point of this test is to make GC walk the large linked list of 
`PhantomCleanable`-s during GC, which replicates what we see in prod-like 
scenarios.

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

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

Reply via email to