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

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?

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


<?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.



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