0

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'.

1 Answer 1

0

I've found a simple solution. I attach the debugger to the process, set a breakpoint and move to the lldb console of android studio. To set a breapoint to a given offset after a function, I enter the command given here https://stackoverflow.com/a/23250892/9459302

For instance b -a (void*()(void, size_t)) myCfunction1 +400

where (void*(*)(void*, size_t)) is the prototype of myCfunction1

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.