1.1 --- a/src/share/vm/memory/metaspace.cpp Tue Mar 12 11:00:49 2013 -0700 1.2 +++ b/src/share/vm/memory/metaspace.cpp Thu Mar 14 10:54:44 2013 +0100 1.3 @@ -1309,8 +1309,7 @@ 1.4 gclog_or_tty->print_cr(" metaspace HWM: %.1fK", new_capacity_until_GC / (double) K); 1.5 } 1.6 } 1.7 - assert(vsl->used_bytes_sum() == used_after_gc && 1.8 - used_after_gc <= vsl->capacity_bytes_sum(), 1.9 + assert(used_after_gc <= vsl->capacity_bytes_sum(), 1.10 "sanity check"); 1.11 1.12 } 1.13 @@ -1970,6 +1969,9 @@ 1.14 } 1.15 1.16 SpaceManager::~SpaceManager() { 1.17 + // This call this->_lock which can't be done while holding expand_lock() 1.18 + const size_t in_use_before = sum_capacity_in_chunks_in_use(); 1.19 + 1.20 MutexLockerEx fcl(SpaceManager::expand_lock(), 1.21 Mutex::_no_safepoint_check_flag); 1.22 1.23 @@ -1987,7 +1989,7 @@ 1.24 1.25 // Have to update before the chunks_in_use lists are emptied 1.26 // below. 1.27 - chunk_manager->inc_free_chunks_total(sum_capacity_in_chunks_in_use(), 1.28 + chunk_manager->inc_free_chunks_total(in_use_before, 1.29 sum_count_in_chunks_in_use()); 1.30 1.31 // Add all the chunks in use by this space manager