RFR: 8213198: G1: Periodic GC should trigger concurrent mark for StringTable cleanup

Monica Beckwith mbeckwit at openjdk.org
Fri Feb 13 02:07:30 UTC 2026


This PR implements [JDK-8213198](https://bugs.openjdk.org/browse/JDK-8213198).

## Problem

G1's StringTable can grow unbounded because concurrent marking (which cleans up dead string table entries) only occurs when IHOP is triggered. Applications with large heaps that create many interned strings but have low heap occupancy may never trigger IHOP, causing the StringTable to bloat indefinitely.

## Solution

Add ergonomic periodic concurrent marking. When `G1PeriodicGCInterval` is not explicitly set on the command line, the new `G1PeriodicGCErgonomicInterval` flag triggers concurrent marks at a configurable interval, enabling StringTable cleanup without user configuration.

## Changes

- Add `G1PeriodicGCErgonomicInterval` experimental flag
- Use `FLAG_IS_DEFAULT()` to distinguish cmdline vs runtime flag settings
- Add behavior table documentation covering all 6 configuration cases
- Add helper predicates for cleaner decision logic
- Consolidate duplicate methods into single `should_use_concurrent_periodic_gc()`

## Testing

- tier1 tests pass
- New JTReg tests:
  - `TestPeriodicGCBehaviorTable` - validates all 6 behavior table cases
  - `TestPeriodicGCStringTableCleanup` - validates ergonomic StringTable cleanup scenario
- SPECjbb2015 Composite validation: tested ergonomic periodic GC, disabled mode, load-threshold gated configurations, and small intervals (500ms). No performance regression for typical configurations; aggressive intervals show expected overhead proportional to concurrent cycle frequency.

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

Commit messages:
 - 8213198: G1: Periodic GC should trigger concurrent mark for StringTable cleanup

Changes: https://git.openjdk.org/jdk/pull/29704/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29704&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8213198
  Stats: 650 lines in 6 files changed: 625 ins; 3 del; 22 mod
  Patch: https://git.openjdk.org/jdk/pull/29704.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29704/head:pull/29704

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


More information about the hotspot-gc-dev mailing list