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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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://dmalloc.com/
http://www.andreasen.org/LeakTracer/
http://memwatch.sourceforge.net/
http://mpatrol.sourceforge.net/
About valgrind: https://stackoverflow.com/a/7815977/814297