RFR: 8353264: ZGC: Windows heap unreserving is broken
Stefan Karlsson
stefank at openjdk.org
Wed Apr 2 11:41:51 UTC 2025
During the development of [JDK-8350441](https://bugs.openjdk.org/browse/JDK-8350441) we found that the functionality to release reserved memory for the heap is broken. The current implementation passes in the size of the reserved memory area, but according to the documentation the call should be done with `0` as the dwSize argument:
If the dwFreeType parameter is MEM_RELEASE, dwSize must be 0 (zero)
Generational ZGC isn't affected by this because we never release any reserved memory for the heap. However, the changes in JDK-8350441 is going to change that and we will start to release memory in certain corner-cases.
In Single-gen ZGC, which exists in older releases, we have paths that do release memory for "views" into the heap. This only happens if something blocks the memory areas were we want to set up our "views" of the heap. We should probably backport this fix to the affected releases.
I've added a unit test that provokes the problem and I have run this fix together with the changes for JDK-8350441.
-------------
Commit messages:
- 8353264: ZGC: Windows heap unreserving is broken
Changes: https://git.openjdk.org/jdk/pull/24377/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24377&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8353264
Stats: 26 lines in 2 files changed: 23 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/24377.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24377/head:pull/24377
PR: https://git.openjdk.org/jdk/pull/24377
More information about the hotspot-dev
mailing list