8005936: PrintNMTStatistics doesn't work for normal JVM exit
authorzgu
Fri, 11 Jan 2013 12:30:54 -0500
changeset 15191 d5f9601f72af
parent 15106 001f075c11da
child 15192 f71a6fb9b532
8005936: PrintNMTStatistics doesn't work for normal JVM exit Summary: Moved NMT shutdown code to JVM exit handler to ensure NMT statistics is printed when PrintNMTStatistics is enabled Reviewed-by: acorn, dholmes, coleenp
hotspot/src/share/vm/runtime/java.cpp
hotspot/src/share/vm/runtime/thread.cpp
--- a/hotspot/src/share/vm/runtime/java.cpp	Tue Jan 08 15:47:23 2013 -0800
+++ b/hotspot/src/share/vm/runtime/java.cpp	Fri Jan 11 12:30:54 2013 -0500
@@ -542,6 +542,10 @@
     BeforeExit_lock->notify_all();
   }
 
+  // Shutdown NMT before exit. Otherwise,
+  // it will run into trouble when system destroys static variables.
+  MemTracker::shutdown(MemTracker::NMT_normal);
+
   #undef BEFORE_EXIT_NOT_RUN
   #undef BEFORE_EXIT_RUNNING
   #undef BEFORE_EXIT_DONE
--- a/hotspot/src/share/vm/runtime/thread.cpp	Tue Jan 08 15:47:23 2013 -0800
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Fri Jan 11 12:30:54 2013 -0500
@@ -4011,10 +4011,6 @@
                          Mutex::_as_suspend_equivalent_flag);
   }
 
-  // Shutdown NMT before exit. Otherwise,
-  // it will run into trouble when system destroys static variables.
-  MemTracker::shutdown(MemTracker::NMT_normal);
-
   // Hang forever on exit if we are reporting an error.
   if (ShowMessageBoxOnError && is_error_reported()) {
     os::infinite_sleep();