14

Does anyone know of memory debugging tools (like Valgrind) for native C++ code under Android NDK?

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
Ravi
  • 3,718
  • 7
  • 39
  • 57
  • The ARM version of valgrind has been "coming soon" for years. If you setprop libc.debug.malloc to 10 and stop/start you will get some additional checks, but I haven't found them to be all that helpful. – fadden Dec 17 '10 at 00:43
  • 1
    Seperate your jni (glue code between java and native impl.) and native implementaion. Using x86 debug tool handle native implementation. – qrtt1 Dec 21 '10 at 12:55

1 Answers1

9

We have a project that uses quite a bit of native code. As hinted in one of the comments for the question, the best approach is to test that code on another environment.

We have a separate project that builds in Linux and calls the C/C++ functions we use in our Android code. Once you are at that point, all the nice tools you are used to (gdb, Valgrind, etc.) are available to you.

A lot more productive than doing the same thing on the phone (assuming you could even find a good tool).

The tricky part is to have a good test harness, but that should be a given to any project that started off on the right path... ;)

Christian Garbin
  • 2,512
  • 1
  • 23
  • 31