RFR: 8365055: G1: Merge Heap Roots phase incorrectly clears young gen remembered set every time [v2]

Thomas Schatzl tschatzl at openjdk.org
Fri Aug 8 14:12:31 UTC 2025


> Hi all,
> 
>   please review this fix to G1 heap root merging that cleared the young gen remembered set multiple times (for every merging) and overwriting the most recent statistics for the number of young gen cards.
> 
> The latter is probably the more problematic, as it directly impacts young gen sizing statistics, potentially making young gen too large.
> 
> The fix is to move the two statements to the proper place - get current number of young gen cards at startup, clear the young gen remset when starting a new collection set - we do not need to do that earlier after all. Additionally we can add some (superfluous?) verification that during GC we really do not add to the young gen remset.
> 
> Testing: tier1-5
> 
> Thanks,
>   Thomas

Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:

  * fix comment in verification code
  * move that G1Policy member to G1CollectedHeap as it's used to verify stuff in G1CollectedHeap (and not used elsewhere anyway)

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26695/files
  - new: https://git.openjdk.org/jdk/pull/26695/files/857fdf91..ba62be50

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

  Stats: 17 lines in 4 files changed: 3 ins; 10 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/26695.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26695/head:pull/26695

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


More information about the hotspot-gc-dev mailing list