changeset 54033:07540197d0fd

8220173: assert(_handle_mark_nesting > 1) failed: memory leak: allocating handle outside HandleMark Reviewed-by: dcubed, redestad
author rehn
date Fri, 08 Mar 2019 12:51:36 +0100
parents ac09c2498c64
children fa9b16328e6a
files src/hotspot/share/runtime/handshake.cpp
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);