fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit

问题:fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit

最近在编译一个VC6.0工程(开发环境:win2000+VS6.0+Sp6),在加入预编译头后出现了下面的编译错误提示:
c:/program files/microsoft visual studio/vc98/include/xlocnum(106) :
fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'msc1.cpp', line 1794)
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information
Error executing cl.exe.

 工程中的每个cpp文件编译都没有问题(除了预编译头对应的cpp文件),很是奇怪,于是在网上找了一下,找到下面一种解决办法:

VC6.0的一个编译错误的解决
在window98下使用vc6.0时,如果预编译头文件(stdafx.h)中包含了模板类的头文件,比如atl的头文件时,编译器会报错:
fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)

造成这种问题的原因是编译器分配的内存超过了限制。
解决的办法有三种:
1.给编译器增大内存限制。在project(工程)->setting(设置)->c/c++的project option(工程选项)中,添加/Zm#nn选项,#nn是一个数字,取值最大为2000。默认为100。但是这种方法好像没有什么用处。
2.将模板类头文件从stdafx.h中移出;
3.不使用预编译头文件。project->setting->c/c++,选择所有的.cpp文件,都使用“不使用预编译头文件“的选项。缺点是编译的时候很慢。

http://www.ieasy.org/yuzuo/archives/2005_07.html

还有一个英文的:

I see that while compiling ITEL.CPP it is trying and failing to open
Debug/IODIARY.PCH. I also see that there is no IODIARY.CPP. Exactly how is
IODIARY.PCH supposed to be created?

Turn off precompiled headers for all files in the project, and rebuild. If
the build still fails, then... uh-oh..

Modify the project to use the default STDAFX.CPP/STDAFX.H method of using
PCH. Then, add an empty file STDAFX.H and an empty file STDAFX.CPP to the
project. Then, for each .CPP file, add as the first line #include
"stdafx.h" . Then compile. This should work. If it does not... uh-oh.

In order for pre-compiled headers to work properly each .CPP must have as
its first #include statement the name of the one .H (such as STDAFX.H) that
includes all the "actual" .H's (windows.h, stdio.h, etc.) that should be
included by ALL .CPPs.

That is the important part. You don't usually want EVERYsingle .H that is
included in ANY .CPP in the project to be in STDAFX.H -- you do normally
want windows.h, because it is the big one that can include a lot and is
usually included in every .CPP. Putting just windows.h in stdafx.h (and
removing it from all the .CPPs) can speed up the build tremendously.

http://www.codecomments.com/archive307-2005-3-421145.html

在MSDN中搜索到这种错误相关主题:

*http://lab.msdn.microsoft.com/productfeedback/SearchResults.aspx?text=fatal+error+C1001%3a+INTERNAL+COMPILER+ERROR&stype=1&fields=1&type=0&witId=0&pId=0&category=0&os=0&oslang=0&status=0&msstatus=0&resolution=0&chgdays=&validation=0&votes=&voterating=0&workarounds=False&attachments=False

*http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/c1001.asp

后来把预编译去掉后,Build终于通过了运行了,可这也太慢了,郁闷中……

还不知有没更好的解决办法??同样的工程放在VC++.net2003中却编译顺利通过,运行正常.!!!!

vc.net解决:可以在   “项目属性”   中   点选   “linker”,然后点选“system”,可以更改heap的指定值。

根据引用[1]中提供的信息,当使用koa框架时,可能会遇到"FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory"的错误。这个错误通常是由于Node.js的内存泄漏导致的。下面是一些解决方法: 1. 增加Node.js的内存限制:可以通过在启动应用程序时使用`--max-old-space-size`标志来增加Node.js的内存限制。例如,`node --max-old-space-size=4096 app.js`将Node.js的内存限制增加到4GB。 2. 优化代码和资源:检查代码中是否存在内存泄漏的问题,例如未释放的资源、循环引用等。确保及时释放不再使用的对象和资源,以减少内存占用。 3. 使用流式处理:对于大型数据集或文件,可以使用流式处理而不是一次性加载到内存中。这可以通过使用适当的流式处理库或技术来实现,例如使用koa的`koa-bodyparser`中间件来处理请求体。 4. 使用缓存:对于频繁访问的数据,可以考虑使用缓存来减少对内存的需求。这可以通过使用适当的缓存库或技术来实现,例如使用Redis作为缓存服务器。 5. 升级Node.js版本:有时,内存泄漏问题可能是由于Node.js版本中的bug引起的。尝试升级到最新的稳定版本,以获得修复可能存在的问题的好处。 这些解决方法可以帮助您解决koa框架中的内存泄漏问题,并避免"FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory"错误的发生。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值