From afc10e174d73363185f42cb67ec429a64549f2c7 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 22 Feb 2013 09:40:58 -0800 Subject: [PATCH] Account malloc mmaped pages as native heap. Currently when malloc uses a page rather than brk the heap gets accounted as ashmem memory. Previously the memory would be accounted as unknown but since [1] it gets accounted as ashmem. This change makes the accounting see this memory as being native, ie the same kind of memory we associate with brk. [1] https://android-review.googlesource.com/#/c/49583/3 Change-Id: I6f496cfeb590268d41d8e047b12cd5c90359e2b0 --- core/jni/android_os_Debug.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp index 6724f367faef8..56b687c892b19 100644 --- a/core/jni/android_os_Debug.cpp +++ b/core/jni/android_os_Debug.cpp @@ -159,7 +159,8 @@ static void read_mapinfo(FILE *fp, stats_t* stats) name = line + name_pos; nameLen = strlen(name); - if (strstr(name, "[heap]") == name) { + if ((strstr(name, "[heap]") == name) || + (strstr(name, "/dev/ashmem/libc malloc") == name)) { whichHeap = HEAP_NATIVE; } else if (strstr(name, "/dev/ashmem/dalvik-") == name) { whichHeap = HEAP_DALVIK;