src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp
changeset 58863 c16ac7a2eba4
parent 55571 49102ba8cf14
--- a/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp	Wed Oct 30 16:14:56 2019 +0100
+++ b/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp	Wed Oct 30 19:43:52 2019 +0100
@@ -31,6 +31,7 @@
 #include "jfr/recorder/service/jfrOptionSet.hpp"
 #include "logging/log.hpp"
 #include "memory/iterator.hpp"
+#include "runtime/mutexLocker.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
 
@@ -92,6 +93,7 @@
   if (!is_running()) {
     return;
   }
+  MutexLocker lock(JfrStream_lock);
   // exclusive access to object sampler instance
   ObjectSampler* const sampler = ObjectSampler::acquire();
   assert(sampler != NULL, "invariant");