summaryrefslogtreecommitdiff
path: root/src/heap_bitmap.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2012-07-03 16:03:35 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2012-07-03 16:03:35 -0700
commit0e7c67ff9aa3744c04fb82d9aee98884fdc5675c (patch)
treeb17f0f5b4643f81ba2e5c8adf9460bac70e30962 /src/heap_bitmap.cc
parentcfab1d9ac52064e6d15e520a76014e6dfb24558c (diff)
parent44a25bbc4626119d24d2cb7378212b6fd0093c19 (diff)
am 44a25bbc: Merge "Fix heap bitmap rounding down size error" into ics-mr1-plus-art
* commit '44a25bbc4626119d24d2cb7378212b6fd0093c19': Fix heap bitmap rounding down size error
Diffstat (limited to 'src/heap_bitmap.cc')
-rw-r--r--src/heap_bitmap.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/heap_bitmap.cc b/src/heap_bitmap.cc
index 769ee9d602..fc722f5dd4 100644
--- a/src/heap_bitmap.cc
+++ b/src/heap_bitmap.cc
@@ -24,7 +24,8 @@ namespace art {
HeapBitmap* HeapBitmap::Create(const char* name, byte* heap_begin, size_t heap_capacity) {
CHECK(heap_begin != NULL);
- size_t bitmap_size = HB_OFFSET_TO_INDEX(heap_capacity) * kWordSize;
+ // Round up since heap_capacity is not necessarily a multiple of kAlignment * kBitsPerWord.
+ size_t bitmap_size = HB_OFFSET_TO_INDEX(RoundUp(heap_capacity, kAlignment * kBitsPerWord)) * kWordSize;
UniquePtr<MemMap> mem_map(MemMap::MapAnonymous(name, NULL, bitmap_size, PROT_READ | PROT_WRITE));
if (mem_map.get() == NULL) {
LOG(ERROR) << "Failed to allocate bitmap " << name;