8260262: Use common code in function unmap_shared() in perfMemory_posix.cpp
Reviewed-by: stuefe, coleenp
This commit is contained in:
parent
f2599ad867
commit
2b05fae155
@ -1023,18 +1023,23 @@ static char* mmap_create_shared(size_t size) {
|
||||
return mapAddress;
|
||||
}
|
||||
|
||||
// release a named shared memory region
|
||||
// release a named shared memory region that was mmap-ed.
|
||||
//
|
||||
static void unmap_shared(char* addr, size_t bytes) {
|
||||
#if defined(_AIX)
|
||||
// Do not rely on os::reserve_memory/os::release_memory to use mmap.
|
||||
// Use os::reserve_memory/os::release_memory for PerfDisableSharedMem=1, mmap/munmap for PerfDisableSharedMem=0
|
||||
if (::munmap(addr, bytes) == -1) {
|
||||
warning("perfmemory: munmap failed (%d)\n", errno);
|
||||
int res;
|
||||
if (MemTracker::tracking_level() > NMT_minimal) {
|
||||
// Note: Tracker contains a ThreadCritical.
|
||||
Tracker tkr(Tracker::release);
|
||||
res = ::munmap(addr, bytes);
|
||||
if (res == 0) {
|
||||
tkr.record((address)addr, bytes);
|
||||
}
|
||||
} else {
|
||||
res = ::munmap(addr, bytes);
|
||||
}
|
||||
if (res != 0) {
|
||||
log_info(os)("os::release_memory failed (" PTR_FORMAT ", " SIZE_FORMAT ")", p2i(addr), bytes);
|
||||
}
|
||||
#else
|
||||
os::release_memory(addr, bytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
// create the PerfData memory region in shared memory.
|
||||
|
Loading…
x
Reference in New Issue
Block a user