Add more detail to rosalloc fragmentation OOME
Also include total number of free page bytes, space footprint, and
space max capacity.
Sample output:
Throwing OutOfMemoryError "Failed to allocate a 7012 byte allocation
with 103464 free bytes and 101KB until OOM; failed due to
fragmentation (required continguous free 8192 bytes, largest
contiguous free 4096 bytes, total free pages 4096 bytes, space
footprint 268435456 bytes, space max capacity 268435456 bytes)
Added a basic test to ensure the allocator coalesces properly.
Bug: 32997082
Test: test-art-host
Change-Id: I642b6ad34b98f6d98c10f242a6f6e926e0b42acc
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 5c219cc..8ff5e5a 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -1326,7 +1326,9 @@
std::ostringstream oss;
size_t total_bytes_free = GetFreeMemory();
oss << "Failed to allocate a " << byte_count << " byte allocation with " << total_bytes_free
- << " free bytes and " << PrettySize(GetFreeMemoryUntilOOME()) << " until OOM";
+ << " free bytes and " << PrettySize(GetFreeMemoryUntilOOME()) << " until OOM,"
+ << " max allowed footprint " << max_allowed_footprint_ << ", growth limit "
+ << growth_limit_;
// If the allocation failed due to fragmentation, print out the largest continuous allocation.
if (total_bytes_free >= byte_count) {
space::AllocSpace* space = nullptr;