mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8005602: NPG: classunloading does not happen while CMS GC with -XX:+CMSClassUnloadingEnabled is used
Call purge() on CLDG after sweep(), reorder purge() call in GenCollectedHeap Reviewed-by: jmasa, stefank
This commit is contained in:
parent
79c091f287
commit
a4a4c34e96
3 changed files with 11 additions and 8 deletions
|
@ -6068,6 +6068,10 @@ void CMSCollector::sweep(bool asynch) {
|
||||||
verify_work_stacks_empty();
|
verify_work_stacks_empty();
|
||||||
verify_overflow_empty();
|
verify_overflow_empty();
|
||||||
|
|
||||||
|
if (should_unload_classes()) {
|
||||||
|
ClassLoaderDataGraph::purge();
|
||||||
|
}
|
||||||
|
|
||||||
_intra_sweep_timer.stop();
|
_intra_sweep_timer.stop();
|
||||||
_intra_sweep_estimate.sample(_intra_sweep_timer.seconds());
|
_intra_sweep_estimate.sample(_intra_sweep_timer.seconds());
|
||||||
|
|
||||||
|
|
|
@ -554,6 +554,8 @@ void GenCollectedHeap::do_collection(bool full,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (complete) {
|
if (complete) {
|
||||||
|
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
||||||
|
ClassLoaderDataGraph::purge();
|
||||||
// Resize the metaspace capacity after full collections
|
// Resize the metaspace capacity after full collections
|
||||||
MetaspaceGC::compute_new_size();
|
MetaspaceGC::compute_new_size();
|
||||||
update_full_collections_completed();
|
update_full_collections_completed();
|
||||||
|
@ -564,11 +566,6 @@ void GenCollectedHeap::do_collection(bool full,
|
||||||
|
|
||||||
gc_epilogue(complete);
|
gc_epilogue(complete);
|
||||||
|
|
||||||
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
|
||||||
if (complete) {
|
|
||||||
ClassLoaderDataGraph::purge();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (must_restore_marks_for_biased_locking) {
|
if (must_restore_marks_for_biased_locking) {
|
||||||
BiasedLocking::restore_marks();
|
BiasedLocking::restore_marks();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1309,8 +1309,7 @@ void MetaspaceGC::compute_new_size() {
|
||||||
gclog_or_tty->print_cr(" metaspace HWM: %.1fK", new_capacity_until_GC / (double) K);
|
gclog_or_tty->print_cr(" metaspace HWM: %.1fK", new_capacity_until_GC / (double) K);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(vsl->used_bytes_sum() == used_after_gc &&
|
assert(used_after_gc <= vsl->capacity_bytes_sum(),
|
||||||
used_after_gc <= vsl->capacity_bytes_sum(),
|
|
||||||
"sanity check");
|
"sanity check");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1970,6 +1969,9 @@ void SpaceManager::initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SpaceManager::~SpaceManager() {
|
SpaceManager::~SpaceManager() {
|
||||||
|
// This call this->_lock which can't be done while holding expand_lock()
|
||||||
|
const size_t in_use_before = sum_capacity_in_chunks_in_use();
|
||||||
|
|
||||||
MutexLockerEx fcl(SpaceManager::expand_lock(),
|
MutexLockerEx fcl(SpaceManager::expand_lock(),
|
||||||
Mutex::_no_safepoint_check_flag);
|
Mutex::_no_safepoint_check_flag);
|
||||||
|
|
||||||
|
@ -1987,7 +1989,7 @@ SpaceManager::~SpaceManager() {
|
||||||
|
|
||||||
// Have to update before the chunks_in_use lists are emptied
|
// Have to update before the chunks_in_use lists are emptied
|
||||||
// below.
|
// below.
|
||||||
chunk_manager->inc_free_chunks_total(sum_capacity_in_chunks_in_use(),
|
chunk_manager->inc_free_chunks_total(in_use_before,
|
||||||
sum_count_in_chunks_in_use());
|
sum_count_in_chunks_in_use());
|
||||||
|
|
||||||
// Add all the chunks in use by this space manager
|
// Add all the chunks in use by this space manager
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue