What is the best way to detect memory leaks in native code built with the android NDK?
Is there any tool like valgrind that I could use?
What is the best way to detect memory leaks in native code built with the android NDK?
Is there any tool like valgrind that I could use?
You load *.so library with System.loadLibrary
, than call any jni functions. So you can define "startup" and "cleanup" functions - you can do your initialzation in former func and release all resources in latter. In this case it's possible to use any from large amount of available leak tracers - for example you can see following:
http://www.andreasen.org/LeakTracer/
http://memwatch.sourceforge.net/
http://mpatrol.sourceforge.net/
About valgrind: https://stackoverflow.com/a/7815977/814297