--- old/src/hotspot/share/prims/jni.cpp Wed Nov 8 09:05:28 2017 +++ new/src/hotspot/share/prims/jni.cpp Wed Nov 8 09:05:27 2017 @@ -4142,7 +4142,7 @@ thread->initialize_thread_current(); if (!os::create_attached_thread(thread)) { - delete thread; + thread->smr_delete(); return JNI_ERR; } // Enable stack overflow checks @@ -4273,7 +4273,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;