RFR: 8366147: ZGC: ZPageAllocator::cleanup_failed_commit_single_partition may leak memory

Axel Boldt-Christmas aboldtch at openjdk.org
Wed Aug 27 10:04:03 UTC 2025


ZPageAllocator::cleanup_failed_commit_single_partition is responsible for cleaning up the successful part of a failed allocation by returning it to the cache so it can be reused.

When a commit fails the the parts that should be returned is any "harvested" memory (memory it took from the cache) and any partially freshly committed memory.

In a late revision of [JDK-8350441](https://bugs.openjdk.org/browse/JDK-8350441) we rewrote part of the allocation logic such that the "harvested" part was no longer part of the partial vmems after successfully harvesting. However the cleanup code was not adapted to this change.

The solution is to add back both the harvested and newly committed memory, not just the newly committed part.

* Testing (In progress)
  * Oracle supported platforms tier1 + ZGC tier1-8

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

Depends on: https://git.openjdk.org/jdk/pull/26953

Commit messages:
 - 8366147: ZGC: ZPageAllocator::cleanup_failed_commit_single_partition may leak memory

Changes: https://git.openjdk.org/jdk/pull/26954/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26954&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366147
  Stats: 20 lines in 2 files changed: 14 ins; 0 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/26954.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26954/head:pull/26954

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


More information about the hotspot-gc-dev mailing list