From 966f533da85f5bf0b17c9de70598707cdc2655a7 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 25 Jan 2016 12:53:03 -0800 Subject: [PATCH] Only create non-moving space at fixed address if zygote Pulled from app image CL, hopefully fixes dex2oat asan failure. Change-Id: I022f7509b534679e5a4ef99ec7a0c622472cf740 --- runtime/gc/heap.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index d6c1817f1..2fb5e349b 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -375,12 +375,15 @@ Heap::Heap(size_t initial_size, } // Attempt to create 2 mem maps at or after the requested begin. if (foreground_collector_type_ != kCollectorTypeCC) { - if (separate_non_moving_space) { - main_mem_map_1.reset(MapAnonymousPreferredAddress(kMemMapSpaceName[0], request_begin, - capacity_, &error_str)); + if (separate_non_moving_space || !is_zygote) { + main_mem_map_1.reset(MapAnonymousPreferredAddress(kMemMapSpaceName[0], + request_begin, + capacity_, + &error_str)); } else { - // If no separate non-moving space, the main space must come - // right after the image space to avoid a gap. + // If no separate non-moving space and we are the zygote, the main space must come right + // after the image space to avoid a gap. This is required since we want the zygote space to + // be adjacent to the image space. main_mem_map_1.reset(MemMap::MapAnonymous(kMemMapSpaceName[0], request_begin, capacity_, PROT_READ | PROT_WRITE, true, false, &error_str)); -- 2.11.0