Integrated: 8325108: POSIX map_memory_to_file calls release_memory unnecessarily

Johan Sjölen jsjolen at openjdk.org
Mon Jan 12 11:05:16 UTC 2026


On Wed, 7 Jan 2026 09:16:57 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: d0aae04d
Author:    Johan Sjölen <jsjolen at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d0aae04d61c90698ab5a01b4389dc6932de63cb7
Stats:     6 lines in 1 file changed: 0 ins; 2 del; 4 mod

8325108: POSIX map_memory_to_file calls release_memory unnecessarily

Reviewed-by: dholmes, coleenp

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

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


More information about the hotspot-runtime-dev mailing list