Virtual memory range for PCH exceeded

I’m using UE built from sources (4.11 from master), VS2015.
I have a project with lots of virtual functions and templates.
And I see the following error.

29>c1xx : error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm90' or greater
29>c1xx : fatal error C1076: compiler limit: internal heap limit reached; use /Zm to specify a higher limit

I saw this option somewhere in UBT, but what is the best way of increasing this limit for the compiler?
I’d like to know the best way to change this in UBT sources.

Or maybe you (Unreal Team) can increase the limit for everyone?

Hi ,

This is a message that myself and a few others here saw on Friday while building the Engine. For us, the occurrence of this message was limited to only once or twice per person who saw it. Do you see this error message consistently when building your project?

I see this 2-3 times. Only on “warmed” VS2015. I.e. no such errors on restarted “cold” VS. This is my first assumption. The second is that I saw this only when my system memory grows over 8-9 GB (with 16 GB in total). So, it can be a compiler issue when a lot of system memory is used. Also I think I saw an internal compiler error once near the error in this question.

I tried again to reproduce this by deliberately increasing the memory my computer was using until I had 4-5 GB available, then building the Engine in Visual Studio 2015. Unfortunately I did not see the error message. Do you only see this when building one project (other projects do not have the same issue)?

I see this in very rare cases. So, I don’t have any statistics. If I had it, I tell it to you. :slight_smile: I tried to reproduce this issue, but after VS restart it’s gone, so I didn’t find any regularity. I’m working with only one project, so no any comparison.

I’m also experiencing this constantly in vs2013 with git 4.10 branch.

\unrealengine\engine\source\runtime\core\public\delegates\DelegateSignatureImpl_Variadics.inl(272): error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of ‘-Zm23’ or greater
25>e:\unrealengine\engine\source\runtime\core\public\delegates\DelegateSignatureImpl_Variadics.inl(272): fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit

I am getting this as well. All the time. I can’t even build UE4.10

+1 here, also cannot build 4.10 on VS2013 Ultimate

In VCToolChain.cs (part of UnrealBuildTool) you can find /Zm1000. I’ve found I’ve had to reduce this number, not increase it. I’ve changed it to /Zm400.

I’ve also noticed that this seems to only occur on the “Shared” PCH generation. For this reason, I’ve also disabled bUseSharedPCHs in my BuildConfiguration file (you can hard code in BuildConfiguration.cs or find your %AppData%\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml and add it there. Here’s what my BuildConfiguration.xml looks like after trying to solve this issue:

<?xml version="1.0" encoding="utf-8"?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
	<BuildConfiguration>
    <ProcessorCountMultiplier>1</ProcessorCountMultiplier>
    <bDisableDebugInfo>true</bDisableDebugInfo>
    <bOmitPCDebugInfoInDevelopment>true</bOmitPCDebugInfoInDevelopment>
    <bUseSharedPCHs>false</bUseSharedPCHs>
  </BuildConfiguration>
</Configuration>

So far I’ve been compiling fine now, but of course it’s taking an extremely long time to compile.

Also getting this from 4.10 Preview 1 following along Battery Collector playlist about 5 hours into the engine.

c1xx: error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm48' or greater

Edit: once I close Visual Studio and hit compile again, every goes fine.

Hello everyone,

I have not been able to reproduce this issue in VS 2015, but I was able to see the error again when trying to build 4.10 Preview 1 in VS 2013. For those of you seeing this happen in VS 2013, do you also have VS 2015 installed or is VS 2013 the only version of Visual Studio that you have?

I uninstalled VS2013; 2015 is my only version.

I have once again encountered the error with VS 2015 running. I was making changes in C++ files and hit compile in UE4. Once again I can confirm that closing VS2015 and hit Compile in UE does not retrigger the error.

I just cloned the latest release version and ran into this issue. Modifying VCToolChain.cs to /Zm400 fixed it for me, thanks!

VS2013 Community(update 5) is my only version, ran into this with a fresh clone of the engine

Modifying VCToolChain.cs to /Zm400 fixed it for me as well…

Only VS 2013 installed, started seeing error when I went from 4.9 to 4.9.2

Hello everyone,

I ran my test again with 4.10 Preview 2 that was released this week, and was able to build it successfully with VS 2013. Has anyone tried Preview 2 yet and run into the same problem?

Also, is this only happening when building the Engine, or are some of you seeing this error when building projects?

It dosen’t seem to happen in preview 2. I updated to preview 2, no issue yet and I didn’t change anything like /zm options.

I’m consistantly getting this with any of the recent 4.10 build (over last couple weeks).

Have 32 bit [community editions w/ visual assist] vs2013 (update 5), and VS2015 installed. 16 gigs of ram ~10 gigs usable at the time of compiling