1 /* |
1 /* |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
1496 |
1496 |
1497 // clear the shared memory region |
1497 // clear the shared memory region |
1498 (void)memset(mapAddress, '\0', size); |
1498 (void)memset(mapAddress, '\0', size); |
1499 |
1499 |
1500 // it does not go through os api, the operation has to record from here |
1500 // it does not go through os api, the operation has to record from here |
1501 MemTracker::record_virtual_memory_reserve((address)mapAddress, size, mtInternal, CURRENT_PC); |
1501 MemTracker::record_virtual_memory_reserve_and_commit((address)mapAddress, |
|
1502 size, CURRENT_PC, mtInternal); |
1502 |
1503 |
1503 return (char*) mapAddress; |
1504 return (char*) mapAddress; |
1504 } |
1505 } |
1505 |
1506 |
1506 // this method deletes the file mapping object. |
1507 // this method deletes the file mapping object. |
1678 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), |
1679 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), |
1679 "Could not map PerfMemory"); |
1680 "Could not map PerfMemory"); |
1680 } |
1681 } |
1681 |
1682 |
1682 // it does not go through os api, the operation has to record from here |
1683 // it does not go through os api, the operation has to record from here |
1683 MemTracker::record_virtual_memory_reserve((address)mapAddress, size, mtInternal, CURRENT_PC); |
1684 MemTracker::record_virtual_memory_reserve_and_commit((address)mapAddress, size, |
|
1685 CURRENT_PC, mtInternal); |
1684 |
1686 |
1685 |
1687 |
1686 *addrp = (char*)mapAddress; |
1688 *addrp = (char*)mapAddress; |
1687 *sizep = size; |
1689 *sizep = size; |
1688 |
1690 |
1832 if (PerfMemory::contains(addr) || PerfMemory::contains(addr + bytes - 1)) { |
1834 if (PerfMemory::contains(addr) || PerfMemory::contains(addr + bytes - 1)) { |
1833 // prevent accidental detachment of this process's PerfMemory region |
1835 // prevent accidental detachment of this process's PerfMemory region |
1834 return; |
1836 return; |
1835 } |
1837 } |
1836 |
1838 |
1837 MemTracker::Tracker tkr = MemTracker::get_virtual_memory_release_tracker(); |
1839 if (MemTracker::tracking_level() > NMT_minimal) { |
1838 remove_file_mapping(addr); |
1840 // it does not go through os api, the operation has to record from here |
1839 // it does not go through os api, the operation has to record from here |
1841 Tracker tkr = MemTracker::get_virtual_memory_release_tracker(); |
1840 tkr.record((address)addr, bytes); |
1842 remove_file_mapping(addr); |
|
1843 tkr.record((address)addr, bytes); |
|
1844 } else { |
|
1845 remove_file_mapping(addr); |
|
1846 } |
1841 } |
1847 } |
1842 |
1848 |
1843 char* PerfMemory::backing_store_filename() { |
1849 char* PerfMemory::backing_store_filename() { |
1844 return sharedmem_fileName; |
1850 return sharedmem_fileName; |
1845 } |
1851 } |