Compact zygote.
We now start out using the bump pointer allocator and switch to
the free list collector (ROSAlloc) after the zygote forks.
Before compaction:
Zygote size: 9060352
After compaction
Zygote size: 8425864
The main reason the size doesn't reduce more is that most of the
zygote space is non-movable objects allocated by
VMRuntime.newNonMovableObject. The objects which are non-movable
but could be movable include around 10000 classes and some number
of fields and methods.
Bug: 8981901
Change-Id: Iea21b70fb7af27cb7e92d72070d278a5cd4026ac
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 6f94714..9215556 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -189,6 +189,9 @@
void RegisterNativeAllocation(JNIEnv* env, int bytes);
void RegisterNativeFree(JNIEnv* env, int bytes);
+ // Change the allocator, updates entrypoints.
+ void ChangeAllocator(AllocatorType allocator);
+
// The given reference is believed to be to an object in the Java heap, check the soundness of it.
void VerifyObjectImpl(const mirror::Object* o);
void VerifyObject(const mirror::Object* o) {
@@ -541,8 +544,6 @@
bool IsEnqueued(mirror::Object* ref) const;
void DelayReferenceReferent(mirror::Class* klass, mirror::Object* obj, RootVisitor mark_visitor,
void* arg) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- // Print a reference queue.
- void PrintReferenceQueue(std::ostream& os, mirror::Object** queue);
// Run the finalizers.
void RunFinalization(JNIEnv* env);
@@ -628,7 +629,7 @@
// What kind of concurrency behavior is the runtime after? True for concurrent mark sweep GC,
// false for stop-the-world mark sweep.
- const bool concurrent_gc_;
+ bool concurrent_gc_;
// How many GC threads we may use for paused parts of garbage collection.
const size_t parallel_gc_threads_;
@@ -776,7 +777,7 @@
UniquePtr<accounting::ObjectStack> live_stack_;
// Allocator type.
- const AllocatorType current_allocator_;
+ AllocatorType current_allocator_;
const AllocatorType current_non_moving_allocator_;
// Which GCs we run in order when we an allocation fails.