1306 if (PrintGCDetails && Verbose) { |
1306 if (PrintGCDetails && Verbose) { |
1307 size_t new_capacity_until_GC = MetaspaceGC::capacity_until_GC_in_bytes(); |
1307 size_t new_capacity_until_GC = MetaspaceGC::capacity_until_GC_in_bytes(); |
1308 gclog_or_tty->print_cr(" metaspace HWM: %.1fK", new_capacity_until_GC / (double) K); |
1308 gclog_or_tty->print_cr(" metaspace HWM: %.1fK", new_capacity_until_GC / (double) K); |
1309 } |
1309 } |
1310 } |
1310 } |
1311 assert(vsl->used_bytes_sum() == used_after_gc && |
1311 assert(used_after_gc <= vsl->capacity_bytes_sum(), |
1312 used_after_gc <= vsl->capacity_bytes_sum(), |
|
1313 "sanity check"); |
1312 "sanity check"); |
1314 |
1313 |
1315 } |
1314 } |
1316 |
1315 |
1317 // Metadebug methods |
1316 // Metadebug methods |
1967 gclog_or_tty->print_cr("SpaceManager(): " PTR_FORMAT, this); |
1966 gclog_or_tty->print_cr("SpaceManager(): " PTR_FORMAT, this); |
1968 } |
1967 } |
1969 } |
1968 } |
1970 |
1969 |
1971 SpaceManager::~SpaceManager() { |
1970 SpaceManager::~SpaceManager() { |
|
1971 // This call this->_lock which can't be done while holding expand_lock() |
|
1972 const size_t in_use_before = sum_capacity_in_chunks_in_use(); |
|
1973 |
1972 MutexLockerEx fcl(SpaceManager::expand_lock(), |
1974 MutexLockerEx fcl(SpaceManager::expand_lock(), |
1973 Mutex::_no_safepoint_check_flag); |
1975 Mutex::_no_safepoint_check_flag); |
1974 |
1976 |
1975 ChunkManager* chunk_manager = vs_list()->chunk_manager(); |
1977 ChunkManager* chunk_manager = vs_list()->chunk_manager(); |
1976 |
1978 |
1984 // Mangle freed memory. |
1986 // Mangle freed memory. |
1985 NOT_PRODUCT(mangle_freed_chunks();) |
1987 NOT_PRODUCT(mangle_freed_chunks();) |
1986 |
1988 |
1987 // Have to update before the chunks_in_use lists are emptied |
1989 // Have to update before the chunks_in_use lists are emptied |
1988 // below. |
1990 // below. |
1989 chunk_manager->inc_free_chunks_total(sum_capacity_in_chunks_in_use(), |
1991 chunk_manager->inc_free_chunks_total(in_use_before, |
1990 sum_count_in_chunks_in_use()); |
1992 sum_count_in_chunks_in_use()); |
1991 |
1993 |
1992 // Add all the chunks in use by this space manager |
1994 // Add all the chunks in use by this space manager |
1993 // to the global list of free chunks. |
1995 // to the global list of free chunks. |
1994 |
1996 |