os::attempt_reserve_memory_at calls:
result = pd_attempt_reserve_memory_at(bytes, addr);
if (result != NULL) {
MemTracker::record_virtual_memory_reserve_and_commit((address)result, bytes, CALLER_PC);
}
pd_attempt_reserve_memory_at calls:
os::reserve_memory, which calls:
result = pd_reserve_memory(bytes, addr, alignment_hint);
if (result != NULL) {
MemTracker::record_virtual_memory_reserve((address)result, bytes, CALLER_PC);
}
This has the effect that we call NMT in this sequence:
MemTracker::record_virtual_memory_reserve(...)
MemTracker::record_virtual_memory_reserve_and_commit(...)
After JDK-8198225 the sequence will be:
MemTracker::record_virtual_memory_reserve(...)
MemTracker::record_virtual_memory_reserve(...)
We should probably only be calling record_virtual_memory_reserve once when calling os::attempt_reserve_memory_at.