I've recently noticed that once I start building the Visual Studio solution I'm working with (~200 C++ projects), I get a very large number of cl.exe processes.
![Task manager screenshot](https://i.stack.imgur.com/MOaLO.png)
I'm not surprised by the fact of several cl.exe running in parallel, because my projects are set up with /MP
option.
![Project settings in one of the projects](https://i.stack.imgur.com/nxMQj.png)
But I would expect that their number would be limited by the following setting in the Visual Studio "Options".
![Visual Studio settings (Tools -> Options)](https://i.stack.imgur.com/TFEBx.png)
我认为在 4 核 PC 上并行运行数十个进程并不是构建解决方案的最有效方法。
所以,基本上我有两个问题:
- 为什么我会观察到这种行为?
- 是否可以限制数量
cl.exe
实例?
P.S.我通常使用 Visual Studio 2013 Update 4 编译解决方案,但使用 Visual Studio 2017 也可以观察到相同的行为。
要限制 cl.exe 的数量,您应该使用此选项(至少在 MSVC 2015 中存在):
工具 -> 选项 -> 项目和解决方案 -> VC++ 项目设置\最大并发 C++ 编译
默认情况下零表示“CPU 数量”。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)