If you’re getting the dreaded “compiler limit: internal heap limit reached” and the corresponding “Failed to create virtual memory for PCH” then you can use the /ZmXXXX switch to increase the heap memory allocated to precompiled header (PCH) compilation.

Luckily, it’s very easy to do in UE4, just put this

…in your target.cs:

WindowsPlatform.PCHMemoryAllocationFactor = 2000;

…or in your BuildConfiguration.xml:


If you’re putting it in the BuildConfiguration.xml then it will apply to any and all of your UE4 projects and will trigger a recompile of source-built engines!

You can increase this number further, it is not a MegaByte figure, rather a scale. More info here:

Some examples: