RFR: 8357445: G1: Time-Based Heap Uncommit During Idle Periods [v3]

Monica Beckwith mbeckwit at openjdk.org
Thu Jul 10 06:29:07 UTC 2025


> **Implements:** https://bugs.openjdk.org/browse/JDK-8357445
> 
> Implement time-based heap uncommit for G1 during idle periods.
> 
> Key changes:
> - Added G1HeapEvaluationTask for periodic heap evaluation
> - Switch from G1ServiceTask to PeriodicTask for virtual thread support
> - Implemented time-based heap sizing policy with configurable uncommit delay
> - Added region activity tracking with last access timestamps
> - Integrated VM_G1ShrinkHeap operation for safe heap shrinking
> - Added new G1 flags: G1UseTimeBasedHeapSizing, G1TimeBasedEvaluationIntervalMillis, G1UncommitDelayMillis, G1MinRegionsToUncommit
> - Added 'sizing' log tag for heap sizing operations
> 
> Comprehensive Test Coverage:
> - Enhanced TestG1RegionUncommit: minimum heap boundaries, concurrent allocation/uncommit scenarios
> - Enhanced TestTimeBasedHeapSizing: humongous object handling, rapid allocation cycles, edge cases
> - Enhanced TestTimeBasedRegionTracking: concurrent region access, lifecycle transition validation
> - Enhanced TestTimeBasedHeapConfig: parameter boundary values, small heap configurations
> 
> This ensures time-based heap uncommit works correctly while maintaining all safety guarantees and test expectations.

Monica Beckwith has updated the pull request incrementally with one additional commit since the last revision:

  Fix merge conflict corruption and restore time-based heap sizing changes
  
  - Restore g1CollectedHeap.cpp, g1CollectedHeap.hpp, g1HeapSizingPolicy.cpp from corrupted single-line format
  - Fix character encoding issue in g1HeapSizingPolicy.hpp (multiplication symbol)
  - All time-based heap sizing features restored and functional
  - Files are now in proper multi-line format and compilable

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26207/files
  - new: https://git.openjdk.org/jdk/pull/26207/files/650870a8..fc815905

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

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

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


More information about the hotspot-dev mailing list