Error C3859: virtual memory range for PCH exceeded

Hello, I’m getting this errors when trying to compile a simple project:

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

This issue has already been discussed here: https://answers.unrealengine.com/questions/311758/virtual-memory-range-for-pch-exceeded.html but no useful information was provided.

I’m only learning programming so the line “please recompile with a command line option of ‘-Zm98’ or greater” says nothing to me.

1 Like

Are you using Visual Studio 2015 with the most recent update?

I believe so. My VS2015 version is 14.0.25421.03 Update 3.

It happened to me twice. First time with a different project. Here’s what I did here.

Created an empty c++ project from Basic Code template > Added a simple cube to the scene > Selected this cube and in the Add component menu selected New c++ component (child of ActorComponent class) > VS generated a default code for it > When trying to compile I get this errors.

I tried making a new project from scratch the same way and it works but when I go back to the old one it still gives errors. It looks like at some point the project got broke for some reason or it got bugged or something. I hadn’t done any work in it yet but if there’s possibility that any project could simply break like this then there should be a solution to fix it.

Hey aristides,

Can you navigate to the project folder that isn’t compiling, select the files in the screenshot below, and delete them. (Your game name will be different than mine but follow the same structure).

102114-ah466607_deletethese.png

When those files are deleted, right click on your .uproject file and choose “Generate Visual Studio project files”. Like:

102115-ah466607_dothis.png

When that is done, you should have a new YOURGAMENAME.sln file. Open that and try to re-compile the project.

Hey,
This has fixed the problem. Now the project builds without errors and I know what to do if it happens again.
Thank you!

Good to hear. Feel free to update this post if you end up having this issue again.

I’ve just started getting this using 4.16. It’s surfaced after adding some new files to the project. I tried the above steps, it still occurs.

If it’s any help, I do use 12 project-specific plugins, and also use XGE.

Thanks! this solved the issue for me :slight_smile:

We have tried all manner of /Zm values and we continue to get this intermittent build failure more often as time goes by. Apparently Microsoft needs to fix the virtual memory management in their compiler…

Also related:

When you starting hitting this error more than 50% of the time, Linux looks increasingly attractive as the OS of choice for working with Unreal. It’s already the OS of choice in animation and visual effects…

Hi All.

The error “C3859: virtual memory range for PCH exceeded; please recompile with a command line option of ‘-Zm98’ or greater fatal error C1076: compiler limit: internal heap limit reached; use /Zm to specify a higher limit” occurs when
your system is not enough of virtual memory.

You can try to increase Paging File Size in your Windows. it is located Control Panel\System and Security\System\Advanced\Settings\Advanced\Change\Virtual Memory.

Hi I know this is an old thread however if anyone else as the issue. Make sure that your Property Specifiers are correct

This usually works for me, but when it doesn’t work, what I found is that I have to restart my computer because I think I had too many applications going that were doing some funky memory stuff even after I closed them. After a restart, this solution worked, but I made sure that I only had Visual Studio running after the restart. Then it built perfectly.