简体   繁体   English

当消耗数GB的内存时,vc ++ 64位程序在新的运算符上崩溃

[英]vc++ 64bit program crashes on a new operator when consume several GBs of memory

I have written a 64bit program which consumes a large bunk of memory. 我已经编写了一个64位程序,该程序占用大量内存。 When it consumes several GB of memory, it causes an error on a new operator. 当它消耗几个GB的内存时,它将在新运算符上引起错误。 But in fact there is still several GB of free memory on this machine to spend. 但是实际上,这台计算机上仍有数GB的可用内存可供使用。 And other program runs correctly with much more memory than this one. 其他程序可以正常运行,并且内存要比此程序多得多。 And I have enabled compilation option /Zm2000 and link option /LARGEADDRESSAWARE. 而且我启用了编译选项/ Zm2000和链接选项/ LARGEADDRESSAWARE。 What is the cause then? 那是什么原因呢?

Even if you still have several GB free, you have to remember that memory can become fragmented . 即使您还有几GB可用空间,也要记住,内存可能会变得碎片化 If there is no contiguous block available to satisfy your request, then the allocation will fail with an exception. 如果没有可用的连续块来满足您的请求,则分配将失败,并出现异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM