C3859:超出了PCH的虚拟内存范围 [英] C3859: Virtual memory range for PCH exceeded

查看:434
本文介绍了C3859:超出了PCH的虚拟内存范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不时(并非每次)都收到此错误消息,我在混合模式项目中进行了编译(对不起,我在这里并没有明确指出:我的意思是重建").而且Visual Studio告诉我使用'-Zm114'或更高版本的命令行选项重新编译".原则上没问题,我就是按照VS告诉我的.

I get this error message from time to time (not every time) I compile ( sorry, I didn't make myself clear here: I actually meant "rebuild") my mixed-mode project. And Visual Studio tells me to "recompile with a command line option of '-Zm114' or greater". In principle no problem, I just do as VS tells me.

但是目前,这有两个问题:

But currently, there are two problems with this:

  1. 为什么每次都不会发生,我要进行重建吗?如果我理解正确,则编译器在编译项目时会耗尽内存.因此,如果我进行重建以清理所有先前的工作,如果我什么都没做,它下次是否也不会耗尽内存?

  1. Why does it not occur every time I do a rebuild? If I understand correctly, the compiler ran out of memory while compiling my project. So if I do a rebuild, which cleans all prior work, shouldn't it run out of memory the next time too, if I don't change anything?

为了安全起见,我已经在该项目的所有配置中为Zm指定了120的值(即 Zm120 ).为什么我得到一个错误消息,该值较低?还是114的建议值只是对VS的疯狂猜测?

To be on the safe side, I already have specified a value of 120 for Zm (ie Zm120) in all configurations of this project. Why do I get an error message with this lower value? Or is the suggested value of 114 just a wild guess of VS?

推荐答案

我知道这很旧,但是我到这里来了,所以我也可以回答.

I know this is old but I ended up here so I might as well answer.

关于PCH问题,有一篇很棒的文章此处.

There is a great article about PCH problems here.

1)为什么每次重新构建都不会发生这种情况?
当然,要回答这个问题有点复杂.由于并非每次都发生,因此可能有几个问题.这很可能是由于内存分配.从文章中:

1) Why does it not occur every time I do a rebuild?
This is a bit complex to answer surely. Since it is not happening every time, it could be several issues. It is most likely due to memory allocation. From the article :

  • 碎片是虚拟机所需的虚拟内存地址范围CL.EXE之前的PCH可以将其加载到内存中.
  • Windows操作系统在重负载下无法在一定的时间阈值内增加页面文件大小.
  • Fragmentation of the virtual memory address range(s) required by the PCH before CL.EXE is able to load it into memory.
  • Failure of the Windows OS under heavy loads to increase the pagefile size within a certain time threshold.

这也可能是Pagefile大小问题(很可能是在虚拟机上),但是我相信您会收到类似以下消息:

It could also be a Pagefile size problem (most likely on Virtual machines) but I believe you would have a message similar to this :

c1xx:错误C3859:无法为PCH [... Project.vcxproj]创建虚拟内存c1xx:注意:系统返回的代码1455:分页文件太小,无法完成此操作

c1xx : error C3859: Failed to create virtual memory for PCH [...Project.vcxproj] c1xx: note: the system returned code 1455: The paging file is too small for this operation to complete

2)为什么我收到一个错误消息,该值较低?(用Zm114代替Zm120)
确保对Zm120的修改可以处理所有构建配置(Release | Debug)和平台(x86 | x64).

2) Why do I get an error message with this lower value? (Zm114 instead of Zm120)
Make sure that the Zm120 modifications handle all the build configurations (Release|Debug) and Platform (x86|x64).

将PreferredToolArchtecture设置为x64也可能有帮助:

It could also help to set PreferredToolArchtecture to x64:

如果您从命令行使用MSBuild,则可以将/p:PreferredToolArchtecture = x64传递给MSBuild.如果要从Visual Studio中使用MSBuild进行构建,则可以编辑.vcxproj文件以包括一个包含此属性的PropertyGroup.

If you’re using MSBuild from the command line you can pass /p:PreferredToolArchtecture=x64 to MSBuild. If you’re building with MSBuild from within Visual Studio, you can edit your .vcxproj file to include a PropertyGroup containing this property.

这个很容易被忽略,但是当预编译的头文件太大时,也会发生这种问题.进行一些清理也可能是一个好主意.

This one is easily overlook, but those kind of problem also happen when the precompiled header is just too big. Doing a little cleanup might be a good idea as well.

这篇关于C3859:超出了PCH的虚拟内存范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆