# Any way to limit the number of "Microsoft C-C++ Compiler Driver" /cl.exe instances while compile?

**URL:** <https://forums.unrealengine.com/t/any-way-to-limit-the-number-of-microsoft-c-c-compiler-driver-cl-exe-instances-while-compile/211403>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [April 3, 2021, 11:15pm UTC](https://forums.unrealengine.com/t/any-way-to-limit-the-number-of-microsoft-c-c-compiler-driver-cl-exe-instances-while-compile/211403 "2021-04-03T23:15:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morderkainer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/morderkainer/32/471559_2.png) [@Morderkainer](https://forums.unrealengine.com/u/Morderkainer)\
**Post date:** [April 3, 2021, 11:15pm UTC](https://forums.unrealengine.com/t/any-way-to-limit-the-number-of-microsoft-c-c-compiler-driver-cl-exe-instances-while-compile/211403/1 "2021-04-03T23:15:58Z")

</div>

Hi, I am facing a weird problem. When I try to compile something, I get tons of “cl.exe” and “Microsoft C-C++ Compiler Driver” spawned in task manager, one for each thread. You could think this is great, more cores working, shorter compile times, but no. Tons of threads trying to compile = tons of RAM being used, and at certain point I reach the evil Virtual Memory, so the compile goes super slow reading from disk.

I tried editing BuildConfiguration.xml to limit the number of threads, tried changing “Maximun Concurrent C++ Compilations” in Visual Studio. At first it works fine, but at some point compilation reaches:

**Using Visual Studio 2019 14.28.29913 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910) and Windows 10.0.18362.0 SDK (D:\Windows Kits\10).  
Building X actions with Z processes…**

Where Z are all the threads and… tons of “cl.exe” and “Microsoft C-C++ Compiler Driver” instances.

So, any idea?

---

<div class="post-metadata">

**Author:** ![UnrealEverything](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnrealEverything](https://forums.unrealengine.com/u/UnrealEverything)\
**Post date:** [April 4, 2021, 8:17am UTC](https://forums.unrealengine.com/t/any-way-to-limit-the-number-of-microsoft-c-c-compiler-driver-cl-exe-instances-while-compile/211403/2 "2021-04-04T08:17:02Z")

</div>

I used to have the same problem on my old machine, this BuildConfiguration.xml worked for me:

```auto

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<ParallelExecutor>
<MaxProcessorCount>2</MaxProcessorCount>
</ParallelExecutor>
</Configuration>

```

Replace 2 with the desired number. Or try _ProcessorCountMultiplier_ with a value less than 1 instead. Note that there are different types of executors, each one can have a different configuration.

---

<div class="post-metadata">

**Author:** ![Morderkainer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/morderkainer/32/471559_2.png) [@Morderkainer](https://forums.unrealengine.com/u/Morderkainer)\
**Post date:** [April 4, 2021, 4:28pm UTC](https://forums.unrealengine.com/t/any-way-to-limit-the-number-of-microsoft-c-c-compiler-driver-cl-exe-instances-while-compile/211403/3 "2021-04-04T16:28:09Z")

</div>

> [@UnrealEverything](#):
>
> I used to have the same problem on my old machine, this BuildConfiguration.xml worked for me:
> 
> ```auto
> 
> <?xml version="1.0" encoding="utf-8" ?>
> <Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
> <ParallelExecutor>
> <MaxProcessorCount>2</MaxProcessorCount>
> </ParallelExecutor>
> </Configuration>
> 
> ```
> 
> Replace 2 with the desired number. Or try _ProcessorCountMultiplier_ with a value less than 1 instead. Note that there are different types of executors, each one can have a different configuration.

Thanks, already had the\*\* X \*\*thing, but looks like it does nothing, doesn’t matter if I set 1 or 200. What did the trick was the **0.X** , lowering the decimal number I’ve been able to limit the number of cl.exe and compiler driver instances.

Just in case someone needs this fix, this is my **BuildConfiguration.xml** , just tweak **0.5** number, smaller decimal = less threads, bigger decimal up to 1 = more threads. **MaxProcessorCount** looks like does nothing, just matched the number of threads at \*\*Building X actions with Z processes… \*\*after tweaking \*\*ProcessorCountMultiplier \*\*just in case.

```auto

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
   <ParallelExecutor>
      <ProcessorCountMultiplier>0.5</ProcessorCountMultiplier>
      <MaxProcessorCount>4</MaxProcessorCount>
   </ParallelExecutor>
</Configuration>

```
