Allocate large enough space bitmaps for malloc spaces.
Fix a bug that we don't allocate space bitmaps for a malloc space that
are large enough to cover the non-growth-limited capacity.
Change-Id: I2e99a70eb8cddc284dffafa2d2afcc2f0c9074c7
diff --git a/runtime/gc/space/malloc_space.cc b/runtime/gc/space/malloc_space.cc
index e710409..57ed0bd 100644
--- a/runtime/gc/space/malloc_space.cc
+++ b/runtime/gc/space/malloc_space.cc
@@ -50,12 +50,12 @@
CHECK(IsAligned<kGcCardSize>(reinterpret_cast<uintptr_t>(mem_map->End())));
live_bitmap_.reset(accounting::ContinuousSpaceBitmap::Create(
StringPrintf("allocspace %s live-bitmap %d", name.c_str(), static_cast<int>(bitmap_index)),
- Begin(), Capacity()));
+ Begin(), NonGrowthLimitCapacity()));
DCHECK(live_bitmap_.get() != nullptr) << "could not create allocspace live bitmap #"
<< bitmap_index;
mark_bitmap_.reset(accounting::ContinuousSpaceBitmap::Create(
StringPrintf("allocspace %s mark-bitmap %d", name.c_str(), static_cast<int>(bitmap_index)),
- Begin(), Capacity()));
+ Begin(), NonGrowthLimitCapacity()));
DCHECK(live_bitmap_.get() != nullptr) << "could not create allocspace mark bitmap #"
<< bitmap_index;
}
@@ -218,10 +218,12 @@
void MallocSpace::Dump(std::ostream& os) const {
os << GetType()
- << " begin=" << reinterpret_cast<void*>(Begin())
- << ",end=" << reinterpret_cast<void*>(End())
- << ",size=" << PrettySize(Size()) << ",capacity=" << PrettySize(Capacity())
- << ",name=\"" << GetName() << "\"]";
+ << " begin=" << reinterpret_cast<void*>(Begin())
+ << ",end=" << reinterpret_cast<void*>(End())
+ << ",limit=" << reinterpret_cast<void*>(Limit())
+ << ",size=" << PrettySize(Size()) << ",capacity=" << PrettySize(Capacity())
+ << ",non_growth_limit_capacity=" << PrettySize(NonGrowthLimitCapacity())
+ << ",name=\"" << GetName() << "\"]";
}
void MallocSpace::SweepCallback(size_t num_ptrs, mirror::Object** ptrs, void* arg) {