GC a lot mode.
Enabling GC a lot mode bounds the size of the allocation stack to
a small value.
Bug: 8509379
Change-Id: Ia098af54b755e03eb78c5128654edfca3f90f391
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 00f7e5b..ece9920 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -60,6 +60,8 @@
static const uint64_t kSlowGcThreshold = MsToNs(100);
// When to create a log message about a long pause, 5ms.
static const uint64_t kLongGcPauseThreshold = MsToNs(5);
+static const bool kGCALotMode = false;
+static const size_t kGcAlotInterval = KB;
static const bool kDumpGcPerformanceOnShutdown = false;
// Minimum amount of remaining bytes before a concurrent GC is triggered.
static const size_t kMinConcurrentRemainingBytes = 128 * KB;
@@ -100,7 +102,13 @@
min_remaining_space_for_sticky_gc_(1 * MB),
last_trim_time_ms_(0),
allocation_rate_(0),
- max_allocation_stack_size_(kDesiredHeapVerification > kNoHeapVerification? KB : MB),
+ /* For GC a lot mode, we limit the allocations stacks to be kGcAlotInterval allocations. This
+ * causes a lot of GC since we do a GC for alloc whenever the stack is full. When heap
+ * verification is enabled, we limit the size of allocation stacks to speed up their
+ * searching.
+ */
+ max_allocation_stack_size_(kGCALotMode ? kGcAlotInterval
+ : (kDesiredHeapVerification > kNoHeapVerification) ? KB : MB),
reference_referent_offset_(0),
reference_queue_offset_(0),
reference_queueNext_offset_(0),