8190357: NMT: Include metadata information in NMT final report when PrintNMTStatistics is on
Summary: Include metadata information in NMT final report
Reviewed-by: adinn, stuefe
--- 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);
}
}
}