Only allocate collectors if we may use them
I believe most of the savings come from not allocating the concurrent
copying 8MB MarkQueue.
Before AOSP hh native PSS:
72653 kB: Native
72998 kB: Native
72882 kB: Native
After AOSP hh native PSS:
64823 kB: Native
65986 kB: Native
64219 kB: Native
Bug: 17643507
Change-Id: Ic5a8e753beca36142c1bf36be6311051f7c78e47
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index b2478e6..d41e17f 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -661,6 +661,9 @@
// Request asynchronous GC.
void RequestConcurrentGC(Thread* self) LOCKS_EXCLUDED(pending_task_lock_);
+ // Whether or not we may use a garbage collector, used so that we only create collectors we need.
+ bool MayUseCollector(CollectorType type) const;
+
private:
class ConcurrentGCTask;
class CollectorTransitionTask;