RFR: 8325108: POSIX map_memory_to_file calls release_memory unnecessarily
Johan Sjölen
jsjolen at openjdk.org
Thu Jan 8 11:21:46 UTC 2026
The implementation of the function os::map_memory_to_file calls os::release_memory if a mmap:ing to a fixed location succeeds but is not at the requested location. A POSIX implementation of mmap is not allowed to succeed and return a different base address if `MAP_FIXED` is supplied, so this is dead code. We can remove it.
Quote:
>When MAP_FIXED is set in the flags argument, the implementation is informed that the value of pa shall be addr, exactly. If MAP_FIXED is set, mmap() may return MAP_FAILED and set errno to [EINVAL]. If a MAP_FIXED request is successful, the mapping established by mmap() replaces any previous mappings for the process' pages in the range [pa,pa+len).
https://pubs.opengroup.org/onlinepubs/009604499/functions/mmap.html
-------------
Commit messages:
- Remove dead branch
Changes: https://git.openjdk.org/jdk/pull/29081/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29081&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8325108
Stats: 6 lines in 1 file changed: 0 ins; 6 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/29081.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29081/head:pull/29081
PR: https://git.openjdk.org/jdk/pull/29081
More information about the hotspot-runtime-dev
mailing list