Limit/set the number of parallel jobs when compiling?

Both when building a project and building the UE4Editor I cannot find a way to limit the number of parallel jobs that clang uses.

So I get:

Performing 351 actions (4 in parallel)

I tried compiling the editor with make -j2 UE4Editor but the build tools completely ignore that.

My problem is that my cpu shows 4 available cpus (2 + 2 hyperthreading) but that gets me out of memory, too many processes, more than my 8GB occupied, system crash (happend two times).

I had to disable hyperthreading on the BIOS so that the build tools sees only 2 cpus and uses half the memory. But of course this is stupid, because I could for example compile with 3 jobs and it would be fine.

After disabling hyperthreading I get:

Performing 351 actions (2 in parallel)

So, my question is: is there any way to limit/set the number of parallel jobs when compiling?

if not, what is the reason for that?

I tried googling a bit and looking for the build tools compile options but couldn’t find the answer

Hi fales,

Please edit Engine/Saved/UnrealBuildTool/BuildConfiguration.xml and add

< MaxProcessorCount >2< /MaxProcessorCount >
in-between
< BuildConfiguration > and < /BuildConfiguration >
which will limit your processor count to 2 (or whichever other number you set there).

There are no spaces after the greater and smaller than signs, I just had to add them to actually display the tags in the post.

Thanks, works like a charm!

Not worked for me, with 4.16 and clang 4.0

Worked for me. with 4.18 and clang 3.8. But I needed to add the BuildConfiguration-Element as well. Full XML-file is (remove spaces after <):

< ?xml version=“1.0” encoding=“utf-8” ?>
< Configuration xmlns=“https://www.unrealengine.com/BuildConfiguration”>
< BuildConfiguration>
< MaxProcessorCount>4
< /BuildConfiguration>
< /Configuration>

As of 4.21 (and perhaps earlier, but I haven’t checked), MaxProcessCount belongs under one of the executor elements (e.g., ParallelExecutor). I’m using the following BuildConfiguration.xml:

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

This BuildConfiguration.xml worked for me:

 <MaxProcessorCount>2</MaxProcessorCount>


 <MaxProcessorCount>2</MaxProcessorCount>

I’ve tried all these things, nothing works?
It detects my changes to the BuildConfiguration.xml file, it says "Creating makefile for xyz (BuildConfiguration.xml is newer)
UE at version 4.25 at the moment, but I’ve tried it several times before with earlier versions.
Thing is, if I don’t limit the threads the compile runs out of memory. Compiling 24 in parallel eats quite a lot of memory :frowning:

For me when building Unreal Engine 5 early access 2 that worked:

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
    <BuildConfiguration>
        <MaxParallelActions>6</MaxParallelActions>
    </BuildConfiguration>
</Configuration>
5 Likes