Should I rely on Clang Static Analyzer or Instruments?

I am working on an iPhone application.

To find memory leaks, I started the application with tools that gave me a lot of leaks. which I couldn’t understand then on the forum, somewhere I read that tools give side leaks someday, so I have to start with Static analysis.

Then I used the Clang Static analyzer, and it gave me only 7 errors after I decided that my application did not contain errors in the static analysis view.

Both test leaks were different.

If I'm still testing tools, it still leaks.

So my question is, should I rely on the results of the clang static analyzer or the tools results.

+1
source share
4 answers

These are free tools that identify problems in your code in two different ways. You must use both.

+5
source

CLANG, saying "no results", does not mean that you are free from errors. This means that "CLANG" has found all the problems that it can find. Just like a leak tool cannot find all the problems that you consider leaks, because there are some things that it cannot detect, and it can only find problems in the application area that you actually tested when it started ...

Think about the general state of errors in your application as an elephant and the various debugging tools in Xcode as stable blinds to try to understand its shape. With enough blind men thrown at the elephant, you will end up zooming in on the form of any problem that you have. That is why you should use all possible tools.

For extra CLAG cleanup power, set the compiler type to CLANG / LLVM. You can only compile for a simulator with this parameter, but when used in combination with a static analyzer, it can find more problems.

+1
source

You should not rely on one or the other; they both do very different things. Use clang to identify potential problems before testing, then use the testing tools.

In addition, make sure that you use tools with both the simulator and the device. If you follow memory management guidelines, you will rarely have a leak, but clang and tools are valuable leak tracking tools that can creep in.

+1
source

Clang is a static analyzer that runs at compile time to provide memory management practices in code. But Instrument is a tool for analyzing device memory at runtime.

Tools should only be used when launching the application on an iOS device. The tool should not be used when the application runs in the iOS simulator.

To provide the best iOS app, we must rely on both the Clang static analyzer and tools.

0
source

All Articles