RFR: 8373203: Genshen: Non-strong reference leak in old gen [v2]

William Kemper wkemper at openjdk.org
Tue Dec 16 19:43:49 UTC 2025


> 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 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 16 additional commits since the last revision:

 - Heal old discovered lists in parallel
 - Fix comment
 - Factor duplicate code into shared method
 - Heal discovered oops in common place for degen and concurrent update refs
 - Merge remote-tracking branch 'jdk/master' into fix-old-reference-processing
 - Clear bootstrap mode for full GC that might have bypassed degenerated cycle
 - Do not bypass card barrier when healing discovered list
 - Consolidate management of bootstrap cycle configuration
 - Use Events::log, not Event for simple log messages
 - Oops, change name of class in test xdoc
 - ... and 6 more: https://git.openjdk.org/jdk/compare/3f36a04d...1aaa4bfb

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28810/files
  - new: https://git.openjdk.org/jdk/pull/28810/files/f8eb0cae..1aaa4bfb

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28810&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28810&range=00-01

  Stats: 312435 lines in 3092 files changed: 209779 ins; 60024 del; 42632 mod
  Patch: https://git.openjdk.org/jdk/pull/28810.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28810/head:pull/28810

PR: https://git.openjdk.org/jdk/pull/28810


More information about the shenandoah-dev mailing list