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

@ -57,6 +57,7 @@
#include "runtime/threadCritical.hpp"
#include "runtime/timer.hpp"
#include "services/attachListener.hpp"
#include "services/memTracker.hpp"
#include "services/runtimeService.hpp"
#include "utilities/decoder.hpp"
#include "utilities/defaultStream.hpp"
@ -2275,13 +2276,25 @@ char* os::reserve_memory_special(size_t bytes, char* req_addr, bool exec) {
return NULL;
}
// The memory is committed
address pc = CALLER_PC;
MemTracker::record_virtual_memory_reserve((address)addr, bytes, pc);
MemTracker::record_virtual_memory_commit((address)addr, bytes, pc);
return addr;
}
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() {