Use HeapGrowthMultiplier for native allocaitons
Reduces the amount of native allocation GCs for foreground apps.
For camera: The number of native allocations GCs goes from 4 to 2,
improving launch time by 25ms (average of 25 runs on pixel).
The multiplier is 1 for low ram devices, so this should not increase
RAM on devices where it matters.
Test: test-art-host
(cherry picked from commit 30baf4a6d7c568e423c9d3e3fa7a7a25ab730b62)
Change-Id: Ifba47cfebab58d9a60a49446929c3475cef9ff14
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index ef4fa28..df097a0 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -4004,7 +4004,8 @@
native_blocking_gcs_finished_++;
native_blocking_gc_cond_->Broadcast(self);
}
- } else if (new_value > NativeAllocationGcWatermark() && !IsGCRequestPending()) {
+ } else if (new_value > NativeAllocationGcWatermark() * HeapGrowthMultiplier() &&
+ !IsGCRequestPending()) {
// Trigger another GC because there have been enough native bytes
// allocated since the last GC.
if (IsGcConcurrent()) {