Print this page
G1: Use SoftMaxHeapSize to guide GC heuristics

@@ -106,11 +106,11 @@
   // considered.
 
   double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0);
 
   return (size_t)MIN2(
-    G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
+    G1CollectedHeap::heap()->soft_max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
     _target_occupancy * (100.0 - _heap_waste_percent) / 100.0
     );
 }
 
 double G1AdaptiveIHOPControl::predict(TruncatedSeq const* seq) const {

@@ -185,5 +185,10 @@
                                           _last_unrestrained_young_size,
                                           predict(&_allocation_rate_s),
                                           predict(&_marking_times_s),
                                           have_enough_data_for_prediction());
 }
+
+size_t G1AdaptiveIHOPControl::predict_unstrained_buffer_size() const {
+  // Besides the young size, the promotion bytes of Prepare Mixed and 1st Mixed GC will be counted
+  return  _last_unrestrained_young_size + _last_allocated_bytes * 2;
+}