Thursday, August 6, 2009

Automatic Memory Leak Tracking on Android

Android provides a mechanism to track memory leakage.
In folder bionic/libc/bionic/malloc_leak.c is compiled into /system/lib/libc_debug.so, it is a memory leakage tracking version of libc.so. To enable the memory leakage tracking, replace the /system/lib/libc.so with the /system/lib/libc_debug.so.
> adb shell mv /system/lib/libc.so /system/lib/libc_original.so
> adb shell mv /system/lib/libc_debug.so /system/lib/libc.so
Before doing that, be sure to remount the system partition to 'rw'.
Use 'mv' command may have problem without libc.so, in that case use 'cp' command instead.
With the memory leak tracking, you shall see something like "MALLOC_DEBUG = 1 (leak checker)" in your logcat output.

10 comments:

Unknown said...

I have one question about memory leak detection:
1. Does "MALLOC_DEBUG = 1 (leak checker)" indicate that
a) there is a memory leak or
b) these is a malloc( )

From my test restul, the answer seems to be (b) theis is a malloc(). If that is the case, how could we locate the exact memory leakage?

旅行中 said...

it will have a report about where memory leak happen ?

we don't need to modify code like we use trace-view ?

Unknown said...

I would like to know what is a memory leak used for. I also would like to know what is Generic Viagra used for
used for too.
There are some very complex topics to understand over the net

tania said...

I never expect some thing like that in my anddroid which is great for fun only.

- Tanya
Web Design Firm

sasha said...

One of the biggest reasons for smartphones from Samsung, Sony Ericsson and Motorola to do roaring business is thanks to the presence of the android applications in them

best android apps

best iphone apps

Stacey said...

Pretty impressed by the caliber of intelligence on the webpage. There are a bunch of great resources here. I know I will check out this place often. iPad Developer

Fara Fae said...

I agree with your opinion. Your article is excellent. I have been examination out some of your stories and i can state pretty nice stuff. I look forward your next article. Its a great post.

4d ultrasounds

onwebmedia said...

Good blog! I genuinely love how it is easy on my eyes as well as the details are well written. I am wondering how I can be notified whenever a new post has been made.
Auto Repair Shop Fort Worth

Dinar Inc said...

You have the right Idea, I like it. You blog is awesome.


Iraqi Dinar

Farrah Khan said...

Intimately, the post is actually the best on this laudable topic. I harmonize with your conclusions and will eagerly look forward to your future updates.~^- organic supplements -^~