3

As you probably know, starting Android O, you can use debug versions of malloc in order to inspect memory usage in native codes. We can use these info in order to find memory leaks in native code which is really useful. Tutorials are available here.

I have tried this tutorial both in emulator and a real device and it successfully enables memory tracing. But problem is that application will not load after enabling this feature and logcat show following error:

E/memtrack: Couldn't load memtrack module
W/android.os.Debug: failed to get memory consumption info: -1

and app will load again when I disable debug version of malloc, so it is obviously connected to setting this option.

I have searched this error and found few topics like this one, but sadly it could not solve my problem. Has anyone else ever encountered this problem? Any idea how to solve it?

Afshin
  • 8,839
  • 1
  • 18
  • 53
  • Hi, do you find any news with your problem? I curious with the debugging memory in C++ on Android, too. Thank you so much – seal2002 Jul 12 '20 at 13:17
  • @seal2002 I could not get this working, though I didn't spend too much time after this thread on that problem. But you can use AddressSanitizer. I were able to get it working. – Afshin Jul 12 '20 at 16:45
  • Thanks for information. I glad to heard you can use ASAN to get it working. I have tried with ASan but not able to get it working. I have the question at [here](https://github.com/android/ndk/issues/933#issuecomment-613155224). Could you please share the tip to make ASAN works? – seal2002 Jul 14 '20 at 13:51
  • @seal2002 Yes, this asan script is old and I worked hard in google forums to make it work. I have another thread for this and google ref is already updated for it. – Afshin Jul 14 '20 at 15:14
  • @you can check them here: https://stackoverflow.com/questions/54550668/cannot-debug-app-when-using-wrapper-script and https://developer.android.com/ndk/guides/wrap-script – Afshin Jul 14 '20 at 15:16
  • @seal2002 above comment :D – Afshin Jul 14 '20 at 15:28
  • Thanks Afshin for those answer :D – seal2002 Jul 16 '20 at 08:43

0 Answers0