ART: Check for no gaps only when we will have an immune region
In dex2oat, for example, this is not necessary. This CL enables running
dex2oat under valgrind.
Change-Id: Ia25c7bfb4903a613c80f4685030970b2a48e24f9
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index f99f361..6a91501 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -407,9 +407,11 @@
mark_compact_collector_ = new collector::MarkCompact(this);
garbage_collectors_.push_back(mark_compact_collector_);
}
- if (GetImageSpace() != nullptr && non_moving_space_ != nullptr) {
+ if (GetImageSpace() != nullptr && non_moving_space_ != nullptr &&
+ (is_zygote || separate_non_moving_space || foreground_collector_type_ == kCollectorTypeGSS)) {
// Check that there's no gap between the image space and the non moving space so that the
- // immune region won't break (eg. due to a large object allocated in the gap).
+ // immune region won't break (eg. due to a large object allocated in the gap). This is only
+ // required when we're the zygote or using GSS.
bool no_gap = MemMap::CheckNoGaps(GetImageSpace()->GetMemMap(),
non_moving_space_->GetMemMap());
if (!no_gap) {