Reputation: 2761
I have tried following istrucions here. to debug my app because it uses C libraries and C memory allocation (I use libgdx) it seems to me that I have a leak in my app but the instructions on the link above say you need an eng phone so I rooted an hct one s and then I have found the following instructions I have found on several websites:
install busybox
adb shell
su
//beware of the following command as you have to type:
mount
//first and then check where /system is in the list
//ext4 and /dev/block/mmcblk0p33 may have to be replaced
mount -o rw,remount -t ext4 /dev/block/mmcblk0p33 /system
cp /system/lib/libc.so /system/lib/libc_original.so
cp doesn't work
cat /system/lib/libc.so > /system/lib/libc_original.so
!!beware this breaks phone check if /system/lib/libc_debug.so exists
adb shell mv /system/lib/libc_debug.so /system/lib/libc.so
So luckily after the last command my phone just rebooted and it's working.
Now I have realised, I don't know where to find libc_debug.so, any ideas? phone is htc one s, android 4.1.1. Where are the libs to be found? with source code?
Next question: is i safe to just replace /system/lib/libc.so by /system/lib/libc_debug.so?
Has any body done that, does it even work?
Upvotes: 2
Views: 1564
Reputation: 1317
You could try cross-compiling valgrind and using that to debug your memory leaks. Not sure how you are doing your development but, if you checkout AOSP you get valgrind in the external/valgrind and gdb and you can build and drop them onto the device you are trying to debug. Dunno if that might help.
Update: Here is a similar approach to what you are doing. They perfomed the steps you did restarted frameworks and then used DDMS to profile for memory leaks, How to Find memory leaks from native code in android and a similar post in a google groups thread seems like thats an alternative.
Upvotes: 2