Android Native Memory allocations and leaks

Prerequisites

   Built Android platform code base, SDK and NDK.

Emulator setup

/out/host/darwin-x86/bin/emulator -system   /out/target/product/generic/system.img -ramdisk out/target/product/generic/ramdisk.img

adb shell setprop libc.debug.malloc 1
adb shell stop
adb shell start

       1  - perform leak detection
       5  - fill allocated memory to detect overruns
     10 - fill memory and add sentinels to detect overruns
     20 - use special instrumented malloc/free routines for the emulator

Host setup

vi ~/.android/ddms.cfg
add a line "native=true"

export ANDROID_SYMBOLS=/out/target/product/generic/symbols
export PATH=$PATH:/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/

DDMS

/tools/ddms

Select the process in ddms and click on Native Heap tab and select "Snapshot Current Native Heap Usage".

Comments

JD said…
This comment has been removed by the author.
JD said…
How did you get this path -
export PATH=$PATH:/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/

?
JD said…
I am using android 4.3 and i dont see the path exists :/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/
Anonymous said…
Toolchains is from Android NDK Installation.

Popular posts from this blog

Android Shared User ID and android:process

Android's Watchdog daemon

Android : Watchdog is killing system server