To find memory leaks of the native C code of my app I run the following command
adb shell dumpsys meminfo --unreachable $(adb shell pidof com.mycompany.myapp)
I get the following output
6 bytes unreachable at ee1551b0
and 654 similar unreachable bytes in 109 allocations
contents:
ee1551b0: 31 2e 30 2e 30 00 1.0.0.
#00 pc 000421e4 /apex/com.android.runtime/lib/bionic/libc.so (malloc +68)
#01 pc 00126670 /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so (myCfunction7 +80)
#02 pc 0011d2b9 /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so
#03 pc 0011d025 /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so (myCfunction6 +165)
#04 pc 0011e82c /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so (myCfunction5 +892)
#05 pc 00120ea7 /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so
#06 pc 0012091c /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so
#07 pc 00120144 /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so
#08 pc 0011eebe /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so
#09 pc 0011e6d4 /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so (myCfunction4 +548)
#10 pc 00121924 /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so (myCfunction3 +68)
#11 pc 00121743 /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so (myCfunction2 +99)
#12 pc 001221c9 /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so (myCfunction1 +409)
#13 pc 00121f4d /data/app/~~XX==/com.mycompany.myapp-W6-xx==/lib/x86/mylib.so (Java_com_mycompany_myapp_myjavaclass_myjavamethod +333)
I'm looking for a simple way to replace offset functions (+333, +409, +99, ...) by line numbers of the source code. I do this kind of stuff by using ndk-stack on tombstone files. Perhaps there is a tool able to decipher the output of 'dumpsys meminfo --unreachable'.