26

Just wondering if someone knows how to find out memory leaks in native code from android. Google search gives lot of solution, but none of them is full. Please let me know if anybody knows how to do this.

NoAIUser
  • 3,966
  • 6
  • 34
  • 52

1 Answers1

31

Really useful information I got to find the leaks in native code.

  1. add native=true in ~/.android/ddms.cfg
  2. replace /system/lib/libc.so with /system/lib/libc_debug.so
    restart the framework, start DDMS, you'll see a tab native-heap

In native-heap, you can see the allocations by native code.

For more information click here

Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
NoAIUser
  • 3,966
  • 6
  • 34
  • 52
  • 6
    Also see this article for a step-by-step guide on getting the DDMS native heap tracking setup: http://bricolsoftconsulting.com/2012/04/25/how-to-enable-native-heap-tracking-in-ddms/ – Theo May 11 '12 at 04:44
  • 6
    Bricolsoft link changed to http://bricolsoftconsulting.com/how-to-enable-native-heap-tracking-in-ddms/ – Peter Tran Dec 17 '13 at 20:13