< prev index next >

src/hotspot/share/memory/metaspace.cpp

Concurrent class unloading
   assert(!SafepointSynchronize::is_at_safepoint()
          || Thread::current()->is_VM_thread(), "should be the VM thread");
 
   DEBUG_ONLY(Atomic::inc(&g_internal_statistics.num_external_deallocs));
 
-  MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
+  MutexLockerEx ml(vsm()->lock()->owned_by_self() ? NULL : vsm()->lock(),
+                   Mutex::_no_safepoint_check_flag);
 
   if (is_class && Metaspace::using_class_space()) {
     class_vsm()->deallocate(ptr, word_size);
   } else {
     vsm()->deallocate(ptr, word_size);
    
< prev index next >