The "wish address" parameter (aka "req_addr") for the os::reserve_memory() API is harmful and should be removed.
See discussion at: http://mail.openjdk.java.net/pipermail/hotspot-dev/2015-April/017823.html.
In short, on mmap-based implementations (linux,bsd,solaris), calling os::reserve_memory() with a non-NULL wish address will trash existing mappings at that address, which is almost never what the programmer wants.
This is not a theoretical issue: programmers tend to confuse os::reserve_memory() with os::attempt_reserve_memory_at(). Unfortunately, often this does not lead to an immediate error, because address space is sparsely populated on 64bit. But if java vm is embedded into another application which already did a number of allocations, chance to trash existing mappings increases.
For all cases where one would want to use a wish address with os::reserve_memory, an alternative API exists. So, this parameter should be removed and code which relies on this parameter closely examined (e.g. seeJDK-8077276).
See discussion at: http://mail.openjdk.java.net/pipermail/hotspot-dev/2015-April/017823.html.
In short, on mmap-based implementations (linux,bsd,solaris), calling os::reserve_memory() with a non-NULL wish address will trash existing mappings at that address, which is almost never what the programmer wants.
This is not a theoretical issue: programmers tend to confuse os::reserve_memory() with os::attempt_reserve_memory_at(). Unfortunately, often this does not lead to an immediate error, because address space is sparsely populated on 64bit. But if java vm is embedded into another application which already did a number of allocations, chance to trash existing mappings increases.
For all cases where one would want to use a wish address with os::reserve_memory, an alternative API exists. So, this parameter should be removed and code which relies on this parameter closely examined (e.g. see
- duplicates
-
JDK-8253638 Cleanup os::reserve_memory and remove MAP_FIXED
-
- Resolved
-
- is blocked by
-
JDK-8245035 Clean up os::split_reserved_memory()
-
- Resolved
-
- relates to
-
JDK-8253638 Cleanup os::reserve_memory and remove MAP_FIXED
-
- Resolved
-
-
JDK-8077276 allocating heap with UseLargePages and HugeTLBFS may trash existing memory mappings (linux)
-
- Resolved
-
-
JDK-8079449 Improve os::attempt_reserve_memory_at() fallback coding on Linux, BSD, Solaris
-
- Closed
-