Fix a per-process dumpsys meminfo crash.

In the InvalidateAllocator() function, DlMallocSpace and RosAllocSpace
both null out the underlying allocator pointer at the zygote fork time
so that new allocations won't accidentally happen in the zygote space
after a zygote fork. However, nulling out the only allocator pointer
would cause crashes in non-allocation uses such as GetFootprint() in
this particular crash. Fix this by creating a second pointer just for
the allocation purpose that gets nulled upon a InvalidateAllocator()
call while the original pointer keeps pointing to the allocator.

Change-Id: Ie751d9380db39baace9e25712a3824eec9a9969a
diff --git a/runtime/gc/space/rosalloc_space.h b/runtime/gc/space/rosalloc_space.h
index 8191ffb..6311580 100644
--- a/runtime/gc/space/rosalloc_space.h
+++ b/runtime/gc/space/rosalloc_space.h
@@ -97,7 +97,7 @@
   mirror::Class* FindRecentFreedObject(const mirror::Object* obj);
 
   virtual void InvalidateAllocator() {
-    rosalloc_ = NULL;
+    rosalloc_for_alloc_ = NULL;
   }
 
   virtual bool IsRosAllocSpace() const {
@@ -130,7 +130,11 @@
   AtomicInteger total_objects_freed_atomic_;
 
   // Underlying rosalloc.
-  art::gc::allocator::RosAlloc* rosalloc_;
+  art::gc::allocator::RosAlloc* const rosalloc_;
+
+  // A rosalloc pointer used for allocation. Equals to what rosalloc_
+  // points to or nullptr after InvalidateAllocator() is called.
+  art::gc::allocator::RosAlloc* rosalloc_for_alloc_;
 
   friend class collector::MarkSweep;