src/share/vm/gc_implementation/shared/vmGCOperations.cpp

Print this page
rev 6671 : 8049831: Metadata Full GCs are not triggered when CMSClassUnloadingEnabled is turned off

@@ -195,14 +195,16 @@
   gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level);
 }
 
 bool VM_CollectForMetadataAllocation::initiate_concurrent_GC() {
 #if INCLUDE_ALL_GCS
-  if (UseConcMarkSweepGC || UseG1GC) {
     if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) {
       MetaspaceGC::set_should_concurrent_collect(true);
-    } else if (UseG1GC) {
+    return true;
+  }
+
+  if (UseG1GC) {
       G1CollectedHeap* g1h = G1CollectedHeap::heap();
       g1h->g1_policy()->set_initiate_conc_mark_if_possible();
 
       GCCauseSetter x(g1h, _gc_cause);
 

@@ -212,15 +214,14 @@
 
       if (should_start) {
         double pause_target = g1h->g1_policy()->max_pause_time_ms();
         g1h->do_collection_pause_at_safepoint(pause_target);
       }
-    }
-
     return true;
   }
 #endif
+
   return false;
 }
 
 static void log_metaspace_alloc_failure_for_concurrent_GC() {
   if (Verbose && PrintGCDetails) {