--- old/src/hotspot/share/runtime/perfMemory.cpp 2017-10-18 15:28:31.247537211 +0900 +++ new/src/hotspot/share/runtime/perfMemory.cpp 2017-10-18 15:28:31.070533674 +0900 @@ -53,6 +53,7 @@ size_t PerfMemory::_capacity = 0; jint PerfMemory::_initialized = false; PerfDataPrologue* PerfMemory::_prologue = NULL; +bool PerfMemory::_destroyed = false; void perfMemory_init() { @@ -64,7 +65,7 @@ void perfMemory_exit() { if (!UsePerfData) return; - if (!PerfMemory::is_initialized()) return; + if (!PerfMemory::is_useable()) return; // Only destroy PerfData objects if we're at a safepoint and the // StatSampler is not active. Otherwise, we risk removing PerfData @@ -160,7 +161,7 @@ void PerfMemory::destroy() { - if (_prologue == NULL) return; + if (!is_useable()) return; if (_start != NULL && _prologue->overflow != 0) { @@ -196,11 +197,7 @@ delete_memory_region(); } - _start = NULL; - _end = NULL; - _top = NULL; - _prologue = NULL; - _capacity = 0; + _destroyed = true; } // allocate an aligned block of memory from the PerfData memory @@ -213,7 +210,7 @@ MutexLocker ml(PerfDataMemAlloc_lock); - assert(_prologue != NULL, "called before initialization"); + assert(is_useable(), "called before initialization"); // check that there is enough memory for this request if ((_top + size) >= _end) {