8008257: NMT: assert(new_rec->is_allocation_record()) failed when running with shared memory option

Corrected virtual memory recording and tagging code when large pages are used

Reviewed-by: coleenp, ccheung
This commit is contained in:
Zhengyu Gu 2013-03-07 14:06:44 -05:00
parent 5116181e1f
commit 4cdcd6dc13
4 changed files with 65 additions and 4 deletions

View file

@ -3420,13 +3420,25 @@ char* os::reserve_memory_special(size_t size, char* addr, bool exec) {
if ((retAddr != NULL) && UseNUMAInterleaving) {
numa_make_global(retAddr, size);
}
// The memory is committed
address pc = CALLER_PC;
MemTracker::record_virtual_memory_reserve((address)retAddr, size, pc);
MemTracker::record_virtual_memory_commit((address)retAddr, size, pc);
return retAddr;
}
bool os::release_memory_special(char* base, size_t bytes) {
// detaching the SHM segment will also delete it, see reserve_memory_special()
int rslt = shmdt(base);
return rslt == 0;
if (rslt == 0) {
MemTracker::record_virtual_memory_uncommit((address)base, bytes);
MemTracker::record_virtual_memory_release((address)base, bytes);
return true;
} else {
return false;
}
}
size_t os::large_page_size() {