From fee09e556f3414bc1027809477c0019084cc01c1 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Fri, 10 Oct 2014 08:40:21 -0700 Subject: [PATCH] Return total footprint, not high water mark. The mallinfo usmblks value returned by dlmalloc is a little misleading. It's not the current max, it's the historical high water mark. This leads to dumpsys meminfo producing native memory numbers that don't add up. Change this to the real total footprint, not this high water mark. Bug: 17265653 (cherry pick from commit f4ada9c9ce31c7e56146a4cb703747385bc043a5) Change-Id: I2fba10285859dccfe8331063c9be14cc169f2d91 --- libc/upstream-dlmalloc/malloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libc/upstream-dlmalloc/malloc.c b/libc/upstream-dlmalloc/malloc.c index 4362f49ff..3c9d36bf4 100644 --- a/libc/upstream-dlmalloc/malloc.c +++ b/libc/upstream-dlmalloc/malloc.c @@ -3526,7 +3526,9 @@ static struct mallinfo internal_mallinfo(mstate m) { nm.arena = sum; nm.ordblks = nfree; nm.hblkhd = m->footprint - sum; - nm.usmblks = m->max_footprint; + /* BEGIN android-changed: usmblks set to footprint from max_footprint */ + nm.usmblks = m->footprint; + /* END android-changed */ nm.uordblks = m->footprint - mfree; nm.fordblks = mfree; nm.keepcost = m->topsize;