Print this page
G1: Use SoftMaxHeapSize to guide GC heuristics

@@ -1207,12 +1207,10 @@
     if (ClassUnloadingWithConcurrentMark) {
       GCTraceTime(Debug, gc, phases) debug("Purge Metaspace", _gc_timer_cm);
       ClassLoaderDataGraph::purge();
     }
 
-    _g1h->resize_heap_if_necessary();
-
     compute_new_sizes();
 
     verify_during_pause(G1HeapVerifier::G1VerifyRemark, VerifyOption_G1UsePrevMarking, "Remark after");
 
     assert(!restart_for_overflow(), "sanity");

@@ -1380,10 +1378,15 @@
 
   // We need to make this be a "collection" so any collection pause that
   // races with it goes around and waits for Cleanup to finish.
   _g1h->increment_total_collections();
 
+  {
+    GCTraceTime(Debug, gc, phases) debug("Expand heap after concurrent mark", _gc_timer_cm);
+    _g1h->expand_heap_after_concurrent_mark();
+  }
+
   // Local statistics
   double recent_cleanup_time = (os::elapsedTime() - start);
   _total_cleanup_time += recent_cleanup_time;
   _cleanup_times.add(recent_cleanup_time);