Memory debug

static const char* DEBUG_MALLOC_PROPERTY_PROGRAM = “libc.debug.malloc.program”;
bionic/libc/bionic/malloc_common.cpp

adb shell am dumpheap -n <PID_TO_DUMP> /data/local/tmp/heap.txt

adb shell stop && adb shell setprop libc.debug.malloc.program zygote && adb shell setprop libc.debug.malloc.options backtrace && adb shell start

pid=adb shell ps -A | grep -i zygote | awk '{print $2}' && adb shell am dumpheap -n $pid /data/local/tmp/heap.txt

bootanimation

adb shell stop && adb shell setprop libc.debug.malloc.program bootanimation && adb shell setprop libc.debug.malloc.options backtrace && adb shell start

pid=adb shell ps -A | grep -i bootanimation | awk '{print $2}' && adb shell am dumpheap -n $pid /data/local/tmp/heap.txt

adb shell ps -A | grep -i bootanimation | awk ‘{print $2} | xargs adb shell kill -28 bootanimation

adb shell stop && adb shell setprop libc.debug.malloc.program zygote && adb shell setprop libc.debug.malloc.options backtrace && adb shell start

DEBUG C memory

adb shell stop && adb shell setprop libc.debug.malloc.program app_process && adb shell setprop libc.debug.malloc.options backtrace=64 && adb shell start

adb shell am dumpheap -n /data/local/tmp/native_heap.txt

adb shell am dumpheap -n 2911 /data/local/tmp/native_heap.txt
adb pull /data/local/tmp/native_heap.txt

DEBUG完全行不通:
https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md


转载请注明: 彪彪 Memory debug

上一篇
Git 下载代理设置 Git 下载代理设置
Git 下载代理设置永久代理git config –global http.proxy ‘socks5://127.0.0.1:1080’git config –global https.proxy ‘socks5://127.0.0.1:
2018-12-07 彪彪
下一篇
Monkey test command Monkey test command
Monkey test commandadb -s 202 shell monkey -s 500 --ignore-crashes --ignore-timeouts --monitor-native-crashes -v 1000000
2018-12-07 彪彪