Estimate allocation rate to predict when to request concurrent GC.
The estimate is bytes allocated between GC divided by time between GC.
Change-Id: I7c82196fdc19061c99651d6d82fd7fcdb3b3608b
diff --git a/src/gc/mark_sweep.cc b/src/gc/mark_sweep.cc
index d02e0cf..d5231ec 100644
--- a/src/gc/mark_sweep.cc
+++ b/src/gc/mark_sweep.cc
@@ -290,9 +290,6 @@
// Unbind the live and mark bitmaps.
UnBindBitmaps();
}
-
- heap_->GrowForUtilization();
- timings_.AddSplit("GrowForUtilization");
}
void MarkSweep::SwapBitmaps() {
@@ -1473,6 +1470,12 @@
heap_->PostGcVerification(this);
+ heap_->GrowForUtilization(GetDuration());
+ timings_.AddSplit("GrowForUtilization");
+
+ heap_->RequestHeapTrim();
+ timings_.AddSplit("RequestHeapTrim");
+
// Update the cumulative statistics
total_time_ += GetDuration();
total_paused_time_ += std::accumulate(GetPauseTimes().begin(), GetPauseTimes().end(), 0,