8220173: assert(_handle_mark_nesting > 1) failed: memory leak: allocating handle outside HandleMark
authorrehn
Fri, 08 Mar 2019 12:51:36 +0100
changeset 54033 07540197d0fd
parent 54032 ac09c2498c64
child 54034 fa9b16328e6a
8220173: assert(_handle_mark_nesting > 1) failed: memory leak: allocating handle outside HandleMark Reviewed-by: dcubed, redestad
src/hotspot/share/runtime/handshake.cpp
--- a/src/hotspot/share/runtime/handshake.cpp	Fri Mar 08 12:01:43 2019 +0100
+++ b/src/hotspot/share/runtime/handshake.cpp	Fri Mar 08 12:51:36 2019 +0100
@@ -288,13 +288,14 @@
   assert(Thread::current() == thread, "should call from thread");
   assert(!thread->is_terminated(), "should not be a terminated thread");
 
-  CautiouslyPreserveExceptionMark pem(thread);
   ThreadInVMForHandshake tivm(thread);
   if (!_semaphore.trywait()) {
     _semaphore.wait_with_safepoint_check(thread);
   }
   HandshakeOperation* op = OrderAccess::load_acquire(&_operation);
   if (op != NULL) {
+    HandleMark hm(thread);
+    CautiouslyPreserveExceptionMark pem(thread);
     // Disarm before execute the operation
     clear_handshake(thread);
     op->do_handshake(thread);