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

Monica Beckwith mbeckwit at openjdk.org
Fri Feb 6 02:28:02 UTC 2026


> **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 improved scheduling
> - 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 refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:

  8357445: Address review feedback with O(1) timestamp reset
  
  - Implement O(1) global timestamp reset
  - Add _last_gc_timestamp member for baseline tracking
  - Call reset_free_region_timestamps() after young and full GC
  - Use MAX2(region_time, _last_gc_time) for effective timestamp calculation
  - Change request_heap_shrink() return type to void
  - Remove unused deactivate_region_at() method
  - Simplify comments to follow conventions
  - Remove redundant ResourceMark and duplicate logging

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26240/files
  - new: https://git.openjdk.org/jdk/pull/26240/files/2c216279..b98f533c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26240&range=13
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26240&range=12-13

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

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


More information about the hotspot-dev mailing list