RFR: 8224871: os::attempt_reserve_memory_at() tries too hard

Erik Österlund erik.osterlund at oracle.com
Tue May 28 13:07:39 UTC 2019


Hi,

The os::attempt_reserve_memory_at() function on BSD, linux and Solaris 
all try a bit too hard. They first try to mmap memory at a given 
address. If that failed, rather than giving up as expected, it tries in 
a loop to mmap random memory (without address hints), and looks if it so 
happens to be that it can from these completely random and arbitrary 
address ranges find overlapping ranges that happen to cross over the 
exact range that was requested, and then cuts out the excess and returns 
that. We really should just give up instead if the OS refused to hand 
out memory at the requested address.

Bug:
https://bugs.openjdk.java.net/browse/JDK-8224871

Webrev:
http://cr.openjdk.java.net/~eosterlund/8224871/webrev.00/

Thanks,
/Erik


More information about the hotspot-runtime-dev mailing list