# HG changeset patch # User ysuenaga # Date 1466493593 -7200 # Node ID 318e93828de11462c79eeb4a64449fa7ec4d57b3 # Parent daf3af35d6bfb3c62b71364626b3c61be1a53377 8155730: HeapInfoDCmd should get Heap_lock Reviewed-by: tschatzl, jprovino diff -r daf3af35d6bf -r 318e93828de1 hotspot/src/share/vm/memory/universe.cpp --- a/hotspot/src/share/vm/memory/universe.cpp Mon Jun 20 22:02:20 2016 -0700 +++ b/hotspot/src/share/vm/memory/universe.cpp Tue Jun 21 09:19:53 2016 +0200 @@ -1070,13 +1070,13 @@ } void Universe::print_on(outputStream* st) { + GCMutexLocker hl(Heap_lock); // Heap_lock might be locked by caller thread. st->print_cr("Heap"); heap()->print_on(st); } void Universe::print_heap_at_SIGBREAK() { if (PrintHeapAtSIGBREAK) { - MutexLocker hl(Heap_lock); print_on(tty); tty->cr(); tty->flush(); diff -r daf3af35d6bf -r 318e93828de1 hotspot/src/share/vm/services/diagnosticCommand.cpp --- a/hotspot/src/share/vm/services/diagnosticCommand.cpp Mon Jun 20 22:02:20 2016 -0700 +++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp Tue Jun 21 09:19:53 2016 +0200 @@ -413,6 +413,7 @@ } void HeapInfoDCmd::execute(DCmdSource source, TRAPS) { + MutexLocker hl(Heap_lock); Universe::heap()->print_on(output()); } diff -r daf3af35d6bf -r 318e93828de1 hotspot/src/share/vm/utilities/vmError.cpp --- a/hotspot/src/share/vm/utilities/vmError.cpp Mon Jun 20 22:02:20 2016 -0700 +++ b/hotspot/src/share/vm/utilities/vmError.cpp Tue Jun 21 09:19:53 2016 +0200 @@ -908,6 +908,7 @@ // STEP("printing heap information") if (Universe::is_fully_initialized()) { + MutexLocker hl(Heap_lock); Universe::heap()->print_on_error(st); st->cr(); st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));