src/share/vm/runtime/thread.cpp

changeset 4057
6dfc6a541338
parent 4053
33143ee07800
child 4077
a7509aff1b06
child 4079
716e6ef4482a
equal deleted inserted replaced
4056:7edbe32b9802 4057:6dfc6a541338
326 326
327 Thread::~Thread() { 327 Thread::~Thread() {
328 // Reclaim the objectmonitors from the omFreeList of the moribund thread. 328 // Reclaim the objectmonitors from the omFreeList of the moribund thread.
329 ObjectSynchronizer::omFlush (this) ; 329 ObjectSynchronizer::omFlush (this) ;
330 330
331 address low_stack_addr = stack_base() - stack_size(); 331 // stack_base can be NULL if the thread is never started or exited before
332 MemTracker::release_thread_stack(low_stack_addr, stack_size(), this); 332 // record_stack_base_and_size called. Although, we would like to ensure
333 // that all started threads do call record_stack_base_and_size(), there is
334 // not proper way to enforce that.
335 if (_stack_base != NULL) {
336 address low_stack_addr = stack_base() - stack_size();
337 MemTracker::release_thread_stack(low_stack_addr, stack_size(), this);
338 }
333 339
334 // deallocate data structures 340 // deallocate data structures
335 delete resource_area(); 341 delete resource_area();
336 // since the handle marks are using the handle area, we have to deallocated the root 342 // since the handle marks are using the handle area, we have to deallocated the root
337 // handle mark before deallocating the thread's handle area, 343 // handle mark before deallocating the thread's handle area,

mercurial