Wednesday, March 28, 2012

memory leak tracking on android, cont

You have Android version >= 2.2.
Make sure you have libc_malloc_debug_leak.so:
  • > adb shell ls /system/lib/libc_malloc_debug_leak.so
Enable the memory leak check:
  • > adb shell setprop libc.debug.malloc 1
Restart the Android framework, make sure the memory leak check is functional:
  • > adb shell stop
  • > adb shell start
  • > adb logcat -b main -v threadtime (you see this line in the printed log: 03-29 03:10:52.942 4200 4200 I libc : /system/bin/logcat using MALLOC_DEBUG = 1 (leak checker))
In your DDMS configuration file (e.g. ~/.android/ddms.cfg on Linux), add "native=true". This enables the Native Heap tab. Now you can use the "Native Heap" tab features to grab snapshots of the heap memory usage. Group by library to view the memory usage in libraries. Show new allocations comparing to the previous snapshot to monitor the memory allocation increments. If you are using the images built by your own, fill the "Symbol Search Path" to get more details information.

More options:
  • > adb shell setprop libc.debug.malloc 5
# For filling allocated /freed memory with patterns defined by CHK_SENTINEL_VALUE, and CHK_FILL_FREE macros.
  • > adb shell setprop libc.debug.malloc 10
# For adding pre-, and post- allocation stubs in order to detect buffer overruns.

6 comments:

Ryder said...

It's really nice that you kept this blog for a really long time. Good job
Type of Business Loans

miccall said...

I sent your articles links to all my contacts and they all love it including me.

http://www.mypaydayloan-quick.info">quick payday loans

Ian bell said...

You have done a amazing job with you website.
penalties for dui

ali khan said...

Hello to every , as I am truly keen of reading this webpage’s post to be updated regularly. It contains nice information.advertising | advertisement | production houses in pakistan | pakistani matrimony

JAMES DEAN said...




Wow, thats amazing.I love the way you write. Do you provide an RSS feed?
Marketing communication strategy | Advertising as profession in Estonia | Advertising professional in Estonia

Best Article Websites said...


At this time it sounds like Movable Type is the preferred blogging platform out there right now. (From what I've read) Is that what you're using in your blog?
Advertising agencies in London