diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-04-15 12:01:58 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-04-15 12:13:36 -0700 |
commit | c4d095bba4d2cbc63ca6ca85787122c0f3e131cf (patch) | |
tree | de3dd89b0d2bb405ee75bbf8ba9024f6ac0ca7b4 /runtime/gc | |
parent | c311d0c85e17773042daaa7a4abc58b3e3c0a0c1 (diff) | |
download | art-c4d095bba4d2cbc63ca6ca85787122c0f3e131cf.zip art-c4d095bba4d2cbc63ca6ca85787122c0f3e131cf.tar.gz art-c4d095bba4d2cbc63ca6ca85787122c0f3e131cf.tar.bz2 |
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
Diffstat (limited to 'runtime/gc')
-rw-r--r-- | runtime/gc/space/malloc_space.cc | 13 |
1 files changed, 4 insertions, 9 deletions
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<MemMap> 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()); |