8005602: NPG: classunloading does not happen while CMS GC with -XX:+CMSClassUnloadingEnabled is used

Thu, 14 Mar 2013 10:54:44 +0100

author
mgerdin
date
Thu, 14 Mar 2013 10:54:44 +0100
changeset 4784
79af1312fc2c
parent 4743
82657b6a8cc0
child 4785
3c226052f7dc

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

src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/genCollectedHeap.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/metaspace.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Tue Mar 12 11:00:49 2013 -0700
     1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Mar 14 10:54:44 2013 +0100
     1.3 @@ -6068,6 +6068,10 @@
     1.4    verify_work_stacks_empty();
     1.5    verify_overflow_empty();
     1.6  
     1.7 +  if (should_unload_classes()) {
     1.8 +    ClassLoaderDataGraph::purge();
     1.9 +  }
    1.10 +
    1.11    _intra_sweep_timer.stop();
    1.12    _intra_sweep_estimate.sample(_intra_sweep_timer.seconds());
    1.13  
     2.1 --- a/src/share/vm/memory/genCollectedHeap.cpp	Tue Mar 12 11:00:49 2013 -0700
     2.2 +++ b/src/share/vm/memory/genCollectedHeap.cpp	Thu Mar 14 10:54:44 2013 +0100
     2.3 @@ -554,6 +554,8 @@
     2.4      }
     2.5  
     2.6      if (complete) {
     2.7 +      // Delete metaspaces for unloaded class loaders and clean up loader_data graph
     2.8 +      ClassLoaderDataGraph::purge();
     2.9        // Resize the metaspace capacity after full collections
    2.10        MetaspaceGC::compute_new_size();
    2.11        update_full_collections_completed();
    2.12 @@ -564,11 +566,6 @@
    2.13  
    2.14      gc_epilogue(complete);
    2.15  
    2.16 -    // Delete metaspaces for unloaded class loaders and clean up loader_data graph
    2.17 -    if (complete) {
    2.18 -      ClassLoaderDataGraph::purge();
    2.19 -    }
    2.20 -
    2.21      if (must_restore_marks_for_biased_locking) {
    2.22        BiasedLocking::restore_marks();
    2.23      }
     3.1 --- a/src/share/vm/memory/metaspace.cpp	Tue Mar 12 11:00:49 2013 -0700
     3.2 +++ b/src/share/vm/memory/metaspace.cpp	Thu Mar 14 10:54:44 2013 +0100
     3.3 @@ -1309,8 +1309,7 @@
     3.4        gclog_or_tty->print_cr("  metaspace HWM: %.1fK", new_capacity_until_GC / (double) K);
     3.5      }
     3.6    }
     3.7 -  assert(vsl->used_bytes_sum() == used_after_gc &&
     3.8 -         used_after_gc <= vsl->capacity_bytes_sum(),
     3.9 +  assert(used_after_gc <= vsl->capacity_bytes_sum(),
    3.10           "sanity check");
    3.11  
    3.12  }
    3.13 @@ -1970,6 +1969,9 @@
    3.14  }
    3.15  
    3.16  SpaceManager::~SpaceManager() {
    3.17 +  // This call this->_lock which can't be done while holding expand_lock()
    3.18 +  const size_t in_use_before = sum_capacity_in_chunks_in_use();
    3.19 +
    3.20    MutexLockerEx fcl(SpaceManager::expand_lock(),
    3.21                      Mutex::_no_safepoint_check_flag);
    3.22  
    3.23 @@ -1987,7 +1989,7 @@
    3.24  
    3.25    // Have to update before the chunks_in_use lists are emptied
    3.26    // below.
    3.27 -  chunk_manager->inc_free_chunks_total(sum_capacity_in_chunks_in_use(),
    3.28 +  chunk_manager->inc_free_chunks_total(in_use_before,
    3.29                                         sum_count_in_chunks_in_use());
    3.30  
    3.31    // Add all the chunks in use by this space manager

mercurial