Fix memory usage regression and clean up collector changing code.
Memory usage regressed since we didn't properly update
concurrent_start_bytes_ when changing collectors.
Bug: 12034247
Change-Id: I1c69e71cd2919e0d3bf75485a4ac0b0aeca59278
diff --git a/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h
index 6e9b04a..08ab6b8 100644
--- a/runtime/gc/heap-inl.h
+++ b/runtime/gc/heap-inl.h
@@ -93,7 +93,7 @@
} else {
DCHECK(!Dbg::IsAllocTrackingEnabled());
}
- if (AllocatorHasConcurrentGC(allocator)) {
+ if (concurrent_gc_) {
CheckConcurrentGC(self, new_num_bytes_allocated, obj);
}
if (kIsDebugBuild) {
@@ -199,9 +199,11 @@
if (!concurrent_gc_) {
if (!grow) {
return true;
- } else {
- max_allowed_footprint_ = new_footprint;
}
+ // TODO: Grow for allocation is racy, fix it.
+ VLOG(heap) << "Growing heap from " << PrettySize(max_allowed_footprint_) << " to "
+ << PrettySize(new_footprint) << " for a " << PrettySize(alloc_size) << " allocation";
+ max_allowed_footprint_ = new_footprint;
}
}
return false;