--- old/src/os/windows/vm/os_windows.cpp 2013-05-13 16:34:01.031571000 -0400 +++ new/src/os/windows/vm/os_windows.cpp 2013-05-13 16:33:59.941587000 -0400 @@ -2847,7 +2847,9 @@ PAGE_READWRITE); // If reservation failed, return NULL if (p_buf == NULL) return NULL; - MemTracker::record_virtual_memory_reserve((address)p_buf, size_of_reserve, CALLER_PC); + NMTTrackOp op(NMTTrackOp::ReserveOp); + op.execute_op((address)p_buf, size_of_reserve, 0, CALLER_PC); + os::release_memory(p_buf, bytes + chunk_size); // we still need to round up to a page boundary (in case we are using large pages) @@ -2912,8 +2914,9 @@ // NMT has yet to record any individual blocks, so it // need to create a dummy 'reserve' record to match // the release. - MemTracker::record_virtual_memory_reserve((address)p_buf, - bytes_to_release, CALLER_PC); + NMTTrackOp res_op(NMTTrackOp::ReserveOp); + res_op.execute_op((address)p_buf, bytes_to_release, 0, CALLER_PC); + os::release_memory(p_buf, bytes_to_release); } #ifdef ASSERT @@ -2932,11 +2935,9 @@ } // Although the memory is allocated individually, it is returned as one. // NMT records it as one block. - address pc = CALLER_PC; - MemTracker::record_virtual_memory_reserve((address)p_buf, bytes, pc); - if ((flags & MEM_COMMIT) != 0) { - MemTracker::record_virtual_memory_commit((address)p_buf, bytes, pc); - } + NMTTrackOp ind_op(((flags & MEM_COMMIT) != 0) ? + NMTTrackOp::ReserveAndCommitOp : NMTTrackOp::ReserveOp); + ind_op.execute_op((address)p_buf, bytes, 0, CALLER_PC); // made it this far, success return p_buf; @@ -3125,9 +3126,8 @@ DWORD flag = MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES; char * res = (char *)VirtualAlloc(NULL, bytes, flag, prot); if (res != NULL) { - address pc = CALLER_PC; - MemTracker::record_virtual_memory_reserve((address)res, bytes, pc); - MemTracker::record_virtual_memory_commit((address)res, bytes, pc); + NMTTrackOp op(NMTTrackOp::ReserveAndCommitOp); + op.execute_op((address)res, bytes, 0, CALLER_PC); } return res; @@ -3136,8 +3136,6 @@ bool os::release_memory_special(char* base, size_t bytes) { assert(base != NULL, "Sanity check"); - // Memory allocated via reserve_memory_special() is committed - MemTracker::record_virtual_memory_uncommit((address)base, bytes); return release_memory(base, bytes); }