Prevent crashes if boot images fail to load
We now reset the requested_alloc_space_begin so that there are no gaps
between any boot images and the non moving space.
Also clear boot_image_spaces so that ClassLinker::InitFromBootImage is
not called.
Finally, delete image spaces so that the maps and oat files are
unmapped.
Bug: 26913820
(cherry picked from commit 1e5ff87e774fdbd46efb1d2f61b1b2ab80145a19)
Change-Id: Ia31937f29ef217eac083165dfff37cd068fbd32b
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index d76a8d1..136b793 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -317,7 +317,10 @@
// Remove already loaded spaces.
for (space::Space* loaded_space : added_image_spaces) {
RemoveSpace(loaded_space);
+ delete loaded_space;
}
+ boot_image_spaces_.clear();
+ requested_alloc_space_begin = nullptr;
break;
}
}