@@ -80,10 +80,16 @@ wait_for_universe_init(); run_service(); terminate(); + + // Can't "delete this" before we terminate as other code + // holds references to 'this', but we must do some cleanup + // ourselves before allowing the native thread to terminate + + ThreadLocalStorage::set_thread(NULL); } void ConcurrentGCThread::stop() { // it is ok to take late safepoints here, if needed {