RFR: 8373203: Genshen: Non-strong reference leak in old gen [v3]
Stefan Karlsson
stefank at openjdk.org
Wed Dec 17 07:58:55 UTC 2025
On Wed, 17 Dec 2025 00:29:18 GMT, William Kemper <wkemper at openjdk.org> wrote:
>> The generational mode for Shenandoah will collect _referents_ for the generation being collected. For example, if we have a young reference pointing to an old referent, that young reference will be processed after we finish marking the old generation. This presents a problem for discovery.
>>
>> When the young mark _encounters_ a young reference with an old referent, it cannot _discover_ it because old marking hasn't finished. However, if it does not discover it, the old referent will be strongly marked. This, in turn, will prevent the old generation from clearing the referent (if it even reaches it again during old marking).
>>
>> To solve this, we let young reference processing discover the old reference by having it use the old generation reference processor to do so. This means the old reference processor can have a discovered list that contains young weak references. If any of these young references reside in a region that is collected, old reference processing will crash when it processes such a reference. Therefore, we add a method `heal_discovered_lists` to traverse the discovered lists after young evacuation is complete. The method will replace any forwarded entries in the discovered list with the forwardee.
>>
>> This PR also extends whitebox testing support for Shenandoah, giving us the ability to trigger young/old collections and interrogate some properties of heaps and regions.
>
> William Kemper has updated the pull request incrementally with one additional commit since the last revision:
>
> Sort includes
I added a few style proposals to make the Shenandoah sections look more consistent with the surrounding style in the shared code.
src/hotspot/share/prims/whitebox.cpp line 704:
> 702: #endif // INCLUDE_G1GC
> 703:
> 704: #if INCLUDE_SHENANDOAHGC
Suggestion:
#if INCLUDE_SHENANDOAHGC
src/hotspot/share/prims/whitebox.cpp line 741:
> 739: WB_END
> 740:
> 741: #endif
Suggestion:
#endif // INCLUDE_SHENANDOAHGC
src/hotspot/share/prims/whitebox.cpp line 2939:
> 2937:
> 2938: #endif
> 2939:
Suggestion:
#endif
test/lib/jdk/test/whitebox/WhiteBox.java line 317:
> 315: public native long[] g1GetMixedGCInfo(int liveness);
> 316:
> 317: public native int shenandoahRegionSize();
Suggestion:
// Shenandoah
public native int shenandoahRegionSize();
-------------
PR Review: https://git.openjdk.org/jdk/pull/28810#pullrequestreview-3586442631
PR Review Comment: https://git.openjdk.org/jdk/pull/28810#discussion_r2625971356
PR Review Comment: https://git.openjdk.org/jdk/pull/28810#discussion_r2625972227
PR Review Comment: https://git.openjdk.org/jdk/pull/28810#discussion_r2625970693
PR Review Comment: https://git.openjdk.org/jdk/pull/28810#discussion_r2625975644
More information about the shenandoah-dev
mailing list