# HG changeset patch # User zgu # Date 1347641750 14400 # Node ID 6dfc6a541338e72a9a1c86439b5a43a453b718ee # Parent 7edbe32b9802a91822e0ca60d3cd11b1bbc7e2a9 7198529: NPG: assert with NMT code in Thread destructor Summary: Thread stack's base address can be NULL if it is not started or exited before recording the base Reviewed-by: kvn, fparain diff -r 7edbe32b9802 -r 6dfc6a541338 src/share/vm/runtime/thread.cpp --- a/src/share/vm/runtime/thread.cpp Thu Sep 13 22:09:16 2012 +0200 +++ b/src/share/vm/runtime/thread.cpp Fri Sep 14 12:55:50 2012 -0400 @@ -328,8 +328,14 @@ // Reclaim the objectmonitors from the omFreeList of the moribund thread. ObjectSynchronizer::omFlush (this) ; - address low_stack_addr = stack_base() - stack_size(); - MemTracker::release_thread_stack(low_stack_addr, stack_size(), this); + // stack_base can be NULL if the thread is never started or exited before + // record_stack_base_and_size called. Although, we would like to ensure + // that all started threads do call record_stack_base_and_size(), there is + // not proper way to enforce that. + if (_stack_base != NULL) { + address low_stack_addr = stack_base() - stack_size(); + MemTracker::release_thread_stack(low_stack_addr, stack_size(), this); + } // deallocate data structures delete resource_area();