src/hotspot/share/services/memTracker.cpp
changeset 47914 564882d918d4
parent 47765 b7c7428eaab9
child 49480 d7df2dd501ce
--- a/src/hotspot/share/services/memTracker.cpp	Thu Nov 16 12:53:29 2017 +0100
+++ b/src/hotspot/share/services/memTracker.cpp	Thu Nov 16 20:21:11 2017 -0500
@@ -25,11 +25,14 @@
 #include "jvm.h"
 
 #include "runtime/mutex.hpp"
+#include "runtime/vmThread.hpp"
+#include "runtime/vm_operations.hpp"
 #include "services/memBaseline.hpp"
 #include "services/memReporter.hpp"
 #include "services/mallocTracker.inline.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/defaultStream.hpp"
+#include "utilities/vmError.hpp"
 
 #ifdef SOLARIS
   volatile bool NMT_stack_walkable = false;
@@ -173,6 +176,11 @@
     } else {
       MemDetailReporter rpt(baseline, output);
       rpt.report();
+
+      // Metadata reporting requires a safepoint, so avoid it if VM is not in good state.
+      assert(!VMError::fatal_error_in_progress(), "Do not report metadata in error report");
+      VM_PrintMetadata vmop(output, K);
+      VMThread::execute(&vmop);
     }
   }
 }