Virtual memory range for PCH exceeded

Windows 10
16 gigs of ram
VS2013(update 5) - 32 bit community
VS2015 - 32 bit community

For those who are still having an issue with this. Not sure why this is only recently affecting me, but here is what i did to fix it.

I noticed my Samsung SSD software “optimization” was changing my virtual memory space / swap file settings. For more info on how to fix it here is the Microsoft page.

I changed it to “system managed”, rather than the default ( which was quite low, thanks samsung)

Win7 16gb ram VS2013
Changing virtual memory to “system managed” didn’t solve the problem for me.
Can some1 explain how to change /Zm1000 to /Zm400?
I’ve found VCToolChain.cs in UnrealBuildTool>Windows.
According to microsoft
I change it in property pages but it’s inactive (grey key in properties) for VCToolChain.cs
I’m kinda new to this so basic explanation would be appriciated.

I’m still having this issue as well with the preview 2 build. and the preview 2 build does not seem to have the /ZmXXX line that people mention below. (Noticed it was removed in the change notes on github)
I’m having this issue when building the UE4 Source itself.

Ok so i repaired the VS2013 and added the /Zm lines that were taken out in the preview 2 in files UWPToolChain.cs and VCToolChain.cs and compiling now seems to be compiling fine now.

Hello everyone,

I just tried building 4.10 Preview 3 with Visual Studio 2013, and did not see the error that I saw in Preview 1. For those of you who were still seeing this happen in Preview 2, does it still happen for you in Preview 3?

Hello everyone,

We did not receive any further reports of this issue occurring in Preview 3 or Preview 4, so we believe it has been resolved. I will be marking this issue as resolved for internal tracking purposes, but if anyone sees it again in 4.10 (released today), please feel free to add a comment and reopen this post.

4.10 release, VS2015. Constantly getting:

error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of ‘-Zm90’ or greater

Hi ,

Are you building the Engine, or do you see this when trying to build a project in Visual Studio? Do you see the same result if you try using the suggested command line option?

Also, would it be possible to get your dxdiag information?

I had to do the opposite. My system managed pagefile was only 300MB and I constantly got the “virtual memory range for PCH exceeded”-message, so I changed it to always be 4GB min and 6GB max. Fixed it for me.

I get this on unreal 4.15.1-release still. Please reopen. I would be happy to provide information needed.

Hey ardneran,

Can you provide any information about the specific issue you’re seeing? Are you compiling the engine from source or a project? What is the exact error message you receive?

I am getting it too, as well as extremely long compile times. I have to compile 3-4 times before I can get a successful compile.
Log is:

Info Total build time: 86.70 seconds (Local executor: 0.00 seconds)
Info Compiling game modules for hot reload
Info Performing 7 actions (4 in parallel)
Info Tank.cpp
Info TankAIController.cpp
Info TankAimingComponent.cpp
Info TankPlayerController.cpp
Info c1xx: error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm111' or greater
Info c1xx: fatal error C1076: compiler limit: internal heap limit reached; use /Zm to specify a higher limit
Info c1xx: error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm111' or greater
Info c1xx: fatal error C1076: compiler limit: internal heap limit reached; use /Zm to specify a higher limit
Info c1xx: error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm111' or greater
Info c1xx: fatal error C1076: compiler limit: internal heap limit reached; use /Zm to specify a higher limit
Info BattleTank.generated.cpp
Info c1xx: error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm111' or greater
Info c1xx: fatal error C1076: compiler limit: internal heap limit reached; use /Zm to specify a higher limit
Info ERROR: UBT ERROR: Failed to produce item: C:\Users\\Documents\Repos\BattleTank\Binaries\Win64\UE4Editor-BattleTank-379.dll

Hey Alphyte-

Please try the solution provided by Langley here:

Error C3859: virtual memory range for PCH exceeded - C++ - Epic Developer Community Forums .

This after generating project files you should be able to compile in Visual Studio without errors.

Hey -

Have you tried the 's answer from the link I provided at the bottom of the page? Let us know if you are still getting this error after following those steps.

Getting this in 4.16, quite regularly now and it’s making bulding a nightmare.
1> Distributing 14 actions to XGE
1> --------------------Project: Default-------------------------------------------
1> PCH.ECGame.cpp (0:38.34 at +0:00)
1> ECGame_OrbManager.cpp (0:01.51 at +0:38)
1>c1xx : error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of ‘-Zm148’ or greater
1>c1xx : fatal error C1076: compiler limit: internal heap limit reached; use /Zm to specify a higher limit
1>
1> Error executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe (tool returned code: 2)
1> ---------------------- Done ----------------------
1>
1> Rebuild All: 0 succeeded, 1 failed, 0 skipped

If you ever see this error, one cause might be that your hard drive is too full. Try freeing up space on your hard drive then trying again. Worked for me.

I know this is quite late for a reply, but I´m just doing the Tutorial as well and for me I got the error because in the video we didnt make a declaration for GetPowerToWin, so for whatever reason the compiler went a little crazy and gave me the compiler limit error. after i made a simple declaration everything was just fine.

Sometimes the compiler gives misleading errors, so you need to look closely and think what you changed since the last compile :wink:

Edit: OR…just watch the next video in my case…

Since I found this issue, I’d just add that the path to this file for me was
C:\Program Files\Epic Games\UE_4.20\Engine\Source\Programs\UnrealBuildTool\Platform\Windows

problem fixed here : The paging file is too small for this operation to complete |failed to create virtual memory for pch - YouTube

Hey guys

I had the same issue and after some investigation I have better solution (it works for me)
I did your actions and it was helpful and engine was successfully compiled from source without any errors

hmoda_12 posted video where the guy fixing the issue adjusting swap file settings
Probably for engine build it will not be enough (for large very projects as well)

I have CPU Ryzen 9 3900X and 32Gb RAM
For people who don’t know it’s 12 cores CPU (24 threads in total)
To build engine I did your solutions to fix the issue but it was not enough for me and I also did configuration to use 12 threads only instead of 24

But everything is much easier
Just let system to manage your swap file size
So I reverted all changes to use all 24 threads to use maximum available performance
My swap size peak was 15Gb during engine building
I have SSD so for me it was pretty fast even with swap

Swap probably is not good idea for SSD but anyway it was a solution and successfully built engine
I also checked SSD state with CrystalDiskInfo, for last 4 years I lost just 13% of disk health so I think even with swap it will be enough for 6-8 years more

Good luck!