comparison src/share/vm/memory/metaspace.cpp @ 8784:79af1312fc2c

8005602: NPG: classunloading does not happen while CMS GC with -XX:+CMSClassUnloadingEnabled is used Summary: Call purge() on CLDG after sweep(), reorder purge() call in GenCollectedHeap Reviewed-by: jmasa, stefank
author mgerdin
date Thu, 14 Mar 2013 10:54:44 +0100
parents 1c88b99a2b01
children 19f9fabd94cc
comparison
equal deleted inserted replaced
8743:82657b6a8cc0 8784:79af1312fc2c
1307 if (PrintGCDetails && Verbose) { 1307 if (PrintGCDetails && Verbose) {
1308 size_t new_capacity_until_GC = MetaspaceGC::capacity_until_GC_in_bytes(); 1308 size_t new_capacity_until_GC = MetaspaceGC::capacity_until_GC_in_bytes();
1309 gclog_or_tty->print_cr(" metaspace HWM: %.1fK", new_capacity_until_GC / (double) K); 1309 gclog_or_tty->print_cr(" metaspace HWM: %.1fK", new_capacity_until_GC / (double) K);
1310 } 1310 }
1311 } 1311 }
1312 assert(vsl->used_bytes_sum() == used_after_gc && 1312 assert(used_after_gc <= vsl->capacity_bytes_sum(),
1313 used_after_gc <= vsl->capacity_bytes_sum(),
1314 "sanity check"); 1313 "sanity check");
1315 1314
1316 } 1315 }
1317 1316
1318 // Metadebug methods 1317 // Metadebug methods
1968 gclog_or_tty->print_cr("SpaceManager(): " PTR_FORMAT, this); 1967 gclog_or_tty->print_cr("SpaceManager(): " PTR_FORMAT, this);
1969 } 1968 }
1970 } 1969 }
1971 1970
1972 SpaceManager::~SpaceManager() { 1971 SpaceManager::~SpaceManager() {
1972 // This call this->_lock which can't be done while holding expand_lock()
1973 const size_t in_use_before = sum_capacity_in_chunks_in_use();
1974
1973 MutexLockerEx fcl(SpaceManager::expand_lock(), 1975 MutexLockerEx fcl(SpaceManager::expand_lock(),
1974 Mutex::_no_safepoint_check_flag); 1976 Mutex::_no_safepoint_check_flag);
1975 1977
1976 ChunkManager* chunk_manager = vs_list()->chunk_manager(); 1978 ChunkManager* chunk_manager = vs_list()->chunk_manager();
1977 1979
1985 // Mangle freed memory. 1987 // Mangle freed memory.
1986 NOT_PRODUCT(mangle_freed_chunks();) 1988 NOT_PRODUCT(mangle_freed_chunks();)
1987 1989
1988 // Have to update before the chunks_in_use lists are emptied 1990 // Have to update before the chunks_in_use lists are emptied
1989 // below. 1991 // below.
1990 chunk_manager->inc_free_chunks_total(sum_capacity_in_chunks_in_use(), 1992 chunk_manager->inc_free_chunks_total(in_use_before,
1991 sum_count_in_chunks_in_use()); 1993 sum_count_in_chunks_in_use());
1992 1994
1993 // Add all the chunks in use by this space manager 1995 // Add all the chunks in use by this space manager
1994 // to the global list of free chunks. 1996 // to the global list of free chunks.
1995 1997