--- old/src/hotspot/share/prims/jni.cpp Tue Nov 21 15:09:59 2017 +++ new/src/hotspot/share/prims/jni.cpp Tue Nov 21 15:09:58 2017 @@ -4140,7 +4140,7 @@ thread->initialize_thread_current(); if (!os::create_attached_thread(thread)) { - delete thread; + thread->smr_delete(); return JNI_ERR; } // Enable stack overflow checks @@ -4271,7 +4271,7 @@ // (platform-dependent) methods where we do alternate stack // maintenance work?) thread->exit(false, JavaThread::jni_detach); - delete thread; + thread->smr_delete(); HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN(JNI_OK); return JNI_OK;