See Malloc Debug and Native Memory Tracking using libc Callbacks for a thorough description of the debugging options available for native memory issues.
Android supports the mallinfo(3)
and malloc_info(3)
extensions to <malloc.h>
.
The malloc_info
function is available in Android 6.0 and later and
its XML schema is documented in Bionic's
<malloc.h>
.
You can also use the Dalvik Debug Monitor Server (DDMS) to obtain a graphical view of Malloc Debug output.
To use DDMS, first turn on its native memory UI:
~/.android/ddms.cfg
native=true
Upon relaunching DDMS and selecting a process, you can switch to the new native allocation tab and populate it with a list of allocations. This is especially useful for debugging memory leaks.