-
Bug
-
Resolution: Fixed
-
P2
-
None
-
b31
-
windows
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8014167 | 8 | Bengt Rutisson | P2 | Closed | Fixed | b89 |
The method ReservedSpace::align_reserved_region() does not work on Windows. It tries to free parts of the previously allocated memory by doing two calls to os::release_memory(). However, on Windows os::release_memory() is implemented as:
VirtualFree(addr, 0, MEM_RELEASE)
which will always free up all the allocated memory:
http://msdn.microsoft.com/en-gb/library/windows/desktop/aa366892%28v=vs.85%29.aspx
"The function frees the entire region that is reserved in the initial allocation call to VirtualAlloc."
This means that if ReservedSpace::align_reserved_region() is executed on Windows and we try to trim the beginning of the memory that we had allocated we will free all of the allocated memory. Subsequent calls to os::commit_memory() which will end up as:
VirtualAlloc(addr, bytes, MEM_COMMIT, PAGE_READWRITE)
will fail with 487, ERROR_INVALID_ADDRESS - Attempt to access invalid address.
VirtualFree(addr, 0, MEM_RELEASE)
which will always free up all the allocated memory:
http://msdn.microsoft.com/en-gb/library/windows/desktop/aa366892%28v=vs.85%29.aspx
"The function frees the entire region that is reserved in the initial allocation call to VirtualAlloc."
This means that if ReservedSpace::align_reserved_region() is executed on Windows and we try to trim the beginning of the memory that we had allocated we will free all of the allocated memory. Subsequent calls to os::commit_memory() which will end up as:
VirtualAlloc(addr, bytes, MEM_COMMIT, PAGE_READWRITE)
will fail with 487, ERROR_INVALID_ADDRESS - Attempt to access invalid address.
- backported by
-
JDK-8014167 ReservedSpace::align_reserved_region() broken on Windows
-
- Closed
-
- relates to
-
JDK-8014611 reserve_and_align() assumptions are invalid on windows
-
- Closed
-