We already have os::vm_min_address(), (introduced as part of JDK-8312018), which returns the system-specific (and sometimes configurable) minimum address of user-mappable memory.
It would be good to have an "os::vm_max_address" counterpart to know the highest address one can obtain. I have needed this on several occasions, instead reverted to hard-coding some "reasonable max" values e.g. in os::attempt_reserve_memory_between, and in gtests. But *knowing* that value would be nicer.
I believe ZGC already does something like this. Maybe the ZGC solution can just be uplifted as a general utility function.
It would be good to have an "os::vm_max_address" counterpart to know the highest address one can obtain. I have needed this on several occasions, instead reverted to hard-coding some "reasonable max" values e.g. in os::attempt_reserve_memory_between, and in gtests. But *knowing* that value would be nicer.
I believe ZGC already does something like this. Maybe the ZGC solution can just be uplifted as a general utility function.