Extend error reporting in art::gc::Heap::GrowForUtilization.
Test: art/test.py
Bug: 73712520
Change-Id: I425368fd0bb69241e986b38c40a541e8f5c05c59
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 17913fc..cb43601 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -3453,7 +3453,8 @@
if (gc_type != collector::kGcTypeSticky) {
// Grow the heap for non sticky GC.
ssize_t delta = bytes_allocated / GetTargetHeapUtilization() - bytes_allocated;
- CHECK_GE(delta, 0);
+ CHECK_GE(delta, 0) << "bytes_allocated=" << bytes_allocated
+ << " target_utilization_=" << target_utilization_;
target_size = bytes_allocated + delta * multiplier;
target_size = std::min(target_size, bytes_allocated + adjusted_max_free);
target_size = std::max(target_size, bytes_allocated + adjusted_min_free);
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 7fb634f..9d2d2ed 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -1331,7 +1331,7 @@
// The ideal maximum free size, when we grow the heap for utilization.
size_t max_free_;
- // Target ideal heap utilization ratio
+ // Target ideal heap utilization ratio.
double target_utilization_;
// How much more we grow the heap when we are a foreground app instead of background.