Question

http://developer.android.com/tools/sdk/ndk/index.html

As the above link suggests, android ndk r8e :

Added static code analyzer for Linux/MacOSX hosts. For information on using the analyzer, see CHANGES.HTML.

In CHANGES.HTML:

  • Added static code analyzer for Linux/MacOSX hosts
    1. For ndk-build, either export NDK_ANALYZE=1 or add it to the command-line.
    2. For standalone, please refer to ndk-build for example to run scan-build using /path/to/standalone/bin//analyzer.

I added the ndk-build NDK_ANALYZE=1 to build command and it builds fine. But how exactly can I use the analyzer to detect memory problems? I didn' t find any documentation.

Was it helpful?

Solution 2

I found the following line in "Console" of eclipse when building the NDK project. I think it' s the answer.

scan-build: Using '/opt/android-ndk/toolchains/llvm-3.2/prebuilt/linux-x86_64/bin/armeabi/analyzer' for static analysis

And in the console at last it shows:

scan-build: 1 bugs found. scan-build: Run 'scan-view /tmp/scan-build-2013-03-29-4' to examine bug reports.

It detects basic errors such as divide by zero, not memory issues, though.

OTHER TIPS

I'm not sure NDK_ANALYZE will help to detect memory leak or not. Currently I'm using Eclipse's plugin cppcheclipse, which can be found here. It has static analysis to check if your code is prone to memory leak.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top