Memory leak in native code using DDMS

888 views
Skip to first unread message

Nand

unread,
Sep 21, 2010, 7:28:48 AM9/21/10
to android-porting
Hi,
I want to find memory leaks in native code. The thread below gives
some information about the same. I added "native=true" in ~/.android/
ddms.cfg and started the stand alone DDMS (in windows ) and I'm also
able to see Native Heap tab in the same.
But no data is shown in that tab. Please let me know if I have to do
some other settings or steps to solve the above issue.


Related thread:
http://groups.google.com/group/android-porting/browse_thread/thread/9c84baa10cebbb68/5940bafea7a5c56f?hl=en&lnk=gst&q=native+heap#

Regards,
Nand

fadden

unread,
Sep 21, 2010, 2:19:00 PM9/21/10
to android-porting
On Sep 21, 4:28 am, Nand <nandithab...@gmail.com> wrote:
> I want to find memory leaks in native code. The thread below gives
> some information about the same. I added "native=true" in ~/.android/
> ddms.cfg and started the stand alone DDMS (in windows ) and I'm also
> able to see Native Heap tab in the same.
> But no data is shown in that tab. Please let me know if I have to do
> some other settings or steps to solve the above issue.

That enables collection; you also need to enable generation.

In recent releases, you can just:

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

(requires root)

When the app framework restarts, the debug version of malloc should be
running.

As mentioned in the thread you linked to, older versions of Android
require substituting the debug version of libc manually.

Nand

unread,
Sep 22, 2010, 12:02:34 AM9/22/10
to android-porting
Hi,
Thanks for replying. Should I have to run the adb commands in command
prompt or in cygwin bash shell?
I'm using android-ndk-r3 version.

Regards,
Nand
Reply all
Reply to author
Forward
0 new messages