Print this page
G1: Use SoftMaxHeapSize to guide GC heuristics

Split Close
Expand all
Collapse all
          --- old/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
          +++ new/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
↓ open down ↓ 1201 lines elided ↑ open up ↑
1202 1202        GCTraceTime(Debug, gc, phases) debug("Reclaim Empty Regions", _gc_timer_cm);
1203 1203        reclaim_empty_regions();
1204 1204      }
1205 1205  
1206 1206      // Clean out dead classes
1207 1207      if (ClassUnloadingWithConcurrentMark) {
1208 1208        GCTraceTime(Debug, gc, phases) debug("Purge Metaspace", _gc_timer_cm);
1209 1209        ClassLoaderDataGraph::purge();
1210 1210      }
1211 1211  
1212      -    _g1h->resize_heap_if_necessary();
1213      -
1214 1212      compute_new_sizes();
1215 1213  
1216 1214      verify_during_pause(G1HeapVerifier::G1VerifyRemark, VerifyOption_G1UsePrevMarking, "Remark after");
1217 1215  
1218 1216      assert(!restart_for_overflow(), "sanity");
1219 1217      // Completely reset the marking state since marking completed
1220 1218      reset_at_marking_complete();
1221 1219    } else {
1222 1220      // We overflowed.  Restart concurrent marking.
1223 1221      _restart_for_overflow = true;
↓ open down ↓ 150 lines elided ↑ open up ↑
1374 1372    if (log_is_enabled(Trace, gc, liveness)) {
1375 1373      G1PrintRegionLivenessInfoClosure cl("Post-Cleanup");
1376 1374      _g1h->heap_region_iterate(&cl);
1377 1375    }
1378 1376  
1379 1377    verify_during_pause(G1HeapVerifier::G1VerifyCleanup, VerifyOption_G1UsePrevMarking, "Cleanup after");
1380 1378  
1381 1379    // We need to make this be a "collection" so any collection pause that
1382 1380    // races with it goes around and waits for Cleanup to finish.
1383 1381    _g1h->increment_total_collections();
     1382 +
     1383 +  {
     1384 +    GCTraceTime(Debug, gc, phases) debug("Expand heap after concurrent mark", _gc_timer_cm);
     1385 +    _g1h->expand_heap_after_concurrent_mark();
     1386 +  }
1384 1387  
1385 1388    // Local statistics
1386 1389    double recent_cleanup_time = (os::elapsedTime() - start);
1387 1390    _total_cleanup_time += recent_cleanup_time;
1388 1391    _cleanup_times.add(recent_cleanup_time);
1389 1392  
1390 1393    {
1391 1394      GCTraceTime(Debug, gc, phases) debug("Finalize Concurrent Mark Cleanup", _gc_timer_cm);
1392 1395      policy->record_concurrent_mark_cleanup_end();
1393 1396    }
↓ open down ↓ 1683 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX