comparison src/os/windows/vm/perfMemory_windows.cpp @ 6882:716c64bda5ba

7199092: NMT: NMT needs to deal overlapped virtual memory ranges Summary: Enhanced virtual memory tracking to track committed regions as well as reserved regions, so NMT now can generate virtual memory map. Reviewed-by: acorn, coleenp
author zgu
date Fri, 19 Oct 2012 21:40:07 -0400
parents b9a9ed0f8eeb
children 4b7cf00ccb08
comparison
equal deleted inserted replaced
6879:8ebcedb7604d 6882:716c64bda5ba
28 #include "memory/resourceArea.hpp" 28 #include "memory/resourceArea.hpp"
29 #include "oops/oop.inline.hpp" 29 #include "oops/oop.inline.hpp"
30 #include "os_windows.inline.hpp" 30 #include "os_windows.inline.hpp"
31 #include "runtime/handles.inline.hpp" 31 #include "runtime/handles.inline.hpp"
32 #include "runtime/perfMemory.hpp" 32 #include "runtime/perfMemory.hpp"
33 #include "services/memTracker.hpp"
33 #include "utilities/exceptions.hpp" 34 #include "utilities/exceptions.hpp"
34 35
35 #include <windows.h> 36 #include <windows.h>
36 #include <sys/types.h> 37 #include <sys/types.h>
37 #include <sys/stat.h> 38 #include <sys/stat.h>
1494 } 1495 }
1495 1496
1496 // clear the shared memory region 1497 // clear the shared memory region
1497 (void)memset(mapAddress, '\0', size); 1498 (void)memset(mapAddress, '\0', size);
1498 1499
1500 // it does not go through os api, the operation has to record from here
1501 MemTracker::record_virtual_memory_reserve((address)mapAddress, size, CURRENT_PC);
1502 MemTracker::record_virtual_memory_type((address)mapAddress, mtInternal);
1503
1499 return (char*) mapAddress; 1504 return (char*) mapAddress;
1500 } 1505 }
1501 1506
1502 // this method deletes the file mapping object. 1507 // this method deletes the file mapping object.
1503 // 1508 //
1670 CloseHandle(fmh); 1675 CloseHandle(fmh);
1671 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), 1676 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(),
1672 "Could not map PerfMemory"); 1677 "Could not map PerfMemory");
1673 } 1678 }
1674 1679
1680 // it does not go through os api, the operation has to record from here
1681 MemTracker::record_virtual_memory_reserve((address)mapAddress, size, CURRENT_PC);
1682 MemTracker::record_virtual_memory_type((address)mapAddress, mtInternal);
1683
1684
1675 *addrp = (char*)mapAddress; 1685 *addrp = (char*)mapAddress;
1676 *sizep = size; 1686 *sizep = size;
1677 1687
1678 // File mapping object can be closed at this time without 1688 // File mapping object can be closed at this time without
1679 // invalidating the mapped view of the file 1689 // invalidating the mapped view of the file
1822 // prevent accidental detachment of this process's PerfMemory region 1832 // prevent accidental detachment of this process's PerfMemory region
1823 return; 1833 return;
1824 } 1834 }
1825 1835
1826 remove_file_mapping(addr); 1836 remove_file_mapping(addr);
1837 // it does not go through os api, the operation has to record from here
1838 MemTracker::record_virtual_memory_release((address)addr, bytes);
1827 } 1839 }
1828 1840
1829 char* PerfMemory::backing_store_filename() { 1841 char* PerfMemory::backing_store_filename() {
1830 return sharedmem_fileName; 1842 return sharedmem_fileName;
1831 } 1843 }