From c4d095bba4d2cbc63ca6ca85787122c0f3e131cf Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Tue, 15 Apr 2014 12:01:58 -0700 Subject: Don't call SetFootprintLimit in CreateZygoteSpace. Since SetFootprintLimit uses the allocators accounting it can set a word inside of the zygote space mem map. This was causing issues since it was occasionally clobbering one of the object classes. This occured since we compact objects into the space which was used by the allocator's internal accounting during zygote bin packing. Also addressed some TODO. Bug: 14056343 Change-Id: I9fc5a61174fa141c0f44d0ed0ae0cc6d77cb4e0a --- runtime/gc/space/malloc_space.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'runtime/gc') diff --git a/runtime/gc/space/malloc_space.cc b/runtime/gc/space/malloc_space.cc index 8f81446..eaf14fb 100644 --- a/runtime/gc/space/malloc_space.cc +++ b/runtime/gc/space/malloc_space.cc @@ -180,11 +180,6 @@ ZygoteSpace* MallocSpace::CreateZygoteSpace(const char* alloc_space_name, bool l << "GrowthLimit " << growth_limit_ << "\n" << "Capacity " << Capacity(); SetGrowthLimit(RoundUp(size, kPageSize)); - SetFootprintLimit(RoundUp(size, kPageSize)); - - // TODO: Not hardcode these in? - const size_t starting_size = kPageSize; - const size_t initial_size = 2 * MB; // FIXME: Do we need reference counted pointers here? // Make the two spaces share the same mark bitmaps since the bitmaps span both of the spaces. VLOG(heap) << "Creating new AllocSpace: "; @@ -196,11 +191,11 @@ ZygoteSpace* MallocSpace::CreateZygoteSpace(const char* alloc_space_name, bool l UniquePtr mem_map(GetMemMap()->RemapAtEnd(end_, alloc_space_name, PROT_READ | PROT_WRITE, &error_msg)); CHECK(mem_map.get() != nullptr) << error_msg; - void* allocator = CreateAllocator(end_, starting_size, initial_size, capacity, low_memory_mode); + void* allocator = CreateAllocator(end_, starting_size_, initial_size_, capacity, low_memory_mode); // Protect memory beyond the initial size. - byte* end = mem_map->Begin() + starting_size; - if (capacity - initial_size > 0) { - CHECK_MEMORY_CALL(mprotect, (end, capacity - initial_size, PROT_NONE), alloc_space_name); + byte* end = mem_map->Begin() + starting_size_; + if (capacity > initial_size_) { + CHECK_MEMORY_CALL(mprotect, (end, capacity - initial_size_, PROT_NONE), alloc_space_name); } *out_malloc_space = CreateInstance(alloc_space_name, mem_map.release(), allocator, end_, end, limit_, growth_limit, CanMoveObjects()); -- cgit v1.1