--- old/src/share/vm/runtime/thread.cpp 2017-05-18 14:10:34.196291631 +0200 +++ new/src/share/vm/runtime/thread.cpp 2017-05-18 14:10:34.033294643 +0200 @@ -336,9 +336,6 @@ Thread::~Thread() { - // Reclaim the objectmonitors from the omFreeList of the moribund thread. - ObjectSynchronizer::omFlush(this); - EVENT_THREAD_DESTRUCT(this); // stack_base can be NULL if the thread is never started or exited before @@ -4251,6 +4248,10 @@ } void Threads::remove(JavaThread* p) { + + // Reclaim the objectmonitors from the omFreeList of the moribund thread. + ObjectSynchronizer::omFlush(p); + // Extra scope needed for Thread_lock, so we can check // that we do not remove thread without safepoint code notice { MutexLocker ml(Threads_lock);