To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (an extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
* By clicking this button you agree to our Privacy Policy statement

Free PVS-Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

Message submitted.

Your message has been sent. We will email you at

If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

PVS-Studio's operation under the Micros…

PVS-Studio's operation under the Microsoft Security Essentials/Windows Defender antivirus

Nov 26 2012

Included into the set of standard preinstalled programs in the Windows 8 operating system, the Microsoft corporation for the first time ships their own antivirus called Windows Defender. Windows Defender actually came included into this set in earlier Windows versions too, but it served as an antispyware and malware filter only. But its latest incarnation under Windows 8 in fact integrates the free antivirus called Microsoft Security Essentials which was available for free download but wasn't integrated into previous Windows versions by default.

When running with Microsoft Security Essentials/Windows Defender active antivirus, PVS-Studio may show a significant slowdown when checking C/C++ files, depending on the analysis settings and user configuration. Before starting the static analysis process itself, PVS-Studio.exe calls the external preprocessor for each of the source-code files to get a full intermediate preprocessed file, i.e. a C/C++ file including header files with expanded macros. In the Visual Studio environment, PVS-Studio can use both the native Visual C++ preprocessor cl.exe and the third-party clang.exe preprocessor shipped inside the PVS-Studio distribution. It is when using cl.exe as the preprocessor that an issue occurs. We've already posted a report on this issue to Microsoft Visual C++ support.

In particular, when using the native Visual C++ cl.exe compiler as the preprocessor on a multi-core computer (when analysis runs in several concurrent threads for several files simultaneously), we can see an induced restriction (imposed by MSE/Windows Defender, as I suspect) on CPU resource usage of total 25% which is imposed for all the cl.exe processes. What does it mean in practice? When utilizing, for instance, 4 of cl.exe processes on a 4-core computer, the maximum total load of these processes doesn't exceed 25%, i.e. each one of them will get only about 6% of CPU execution time. But we are expecting that each one of these processes should get 25% of CPU time (when there's no background CPU load, of course)! It's clear that such a slow-down of each cl.exe will cause a significant increase of analysis time for each file being checked. Our experiments have shown that this 25% restriction doesn't relate to the number of cores in the system: we observed the same 1/4 performance restriction, working on an 8-core computer, and even binding cl.exe processes to different cores didn't change anything.

In the general case, we recommend that you always should add both the analyzer unit itself (PVS-Studio.exe) and all the software utilizing it, as well as their corresponding paths (for example, devenv.exe - the main executable of the Visual Studio environment), into the antivirus's exceptions list, when running PVS-Studio static analyzer under active antivirus software. Unfortunately, adding PVS-Studio.exe (as well as devenv.exe, cmd.exe and even cl.exe itself) into MSE/Windows Defender's exceptions list or even disabling the real-time protection don't fix the issue of performance loss with the cl.exe preprocessor. Only completely disabling MSE/Windows Defender (or replacing it with a different antivirus) allows you to use 100% of CPU resources for the preprocessing purpose.

So, the question arises: how does the build of Visual C++ projects progress when using the same cl.exe directly from the Visual Studio environment? For the build to run in parallel, i.e. to have several cl.exe processes run simultaneously, you need a solution containing at least several projects. An ordinary test build of such a solution (containing 87 of Visual C++ 10.0 projects) didn't reveal any performance issues at first sight. However, adding the compilation flags /P and /c to the properties for each of these projects (i.e. for preprocessing a file into an i file without linking) had actually caused the issue described above: 8 cl.exe processes were running under 2-3% of processor load each; that is, the total CPU load didn't exceed 25% again. Thus, this proves that the performance degradation with the Visual C++ preprocessor launched together with the MSE/Windows Defender doesn't depend on how it is started and whether it is launched from the PVS-Studio analyzer, the Visual Studio environment, or even manually from a cmd file. We can only suppose that when the preprocessing mode is enabled, cl.exe generates and actively writes to the intermediate i file on the hard disk, and the antivirus doesn't like it for some reason.

Popular related articles
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: Oct 22 2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: Nov 21 2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
Free PVS-Studio for those who develops open source projects

Date: Dec 22 2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
The Evil within the Comparison Functions

Date: May 19 2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
The Ultimate Question of Programming, Refactoring, and Everything

Date: Apr 14 2016

Author: Andrey Karpov

Yes, you've guessed correctly - the answer is "42". In this article you will find 42 recommendations about coding in C++ that can help a programmer avoid a lot of errors, save time and effort. The au…
PVS-Studio ROI

Date: Jan 30 2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…
PVS-Studio for Java

Date: Jan 17 2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…
Static analysis as part of the development process in Unreal Engine

Date: Jun 27 2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…
Appreciate Static Code Analysis!

Date: Oct 16 2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: Jul 31 2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…

Comments (0)

Next comments
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →