问题描述
这行代码产生如下错误
rs[se_idx][ev_idx][re_idx].trs = new re_class[report_size];
std::bad_alloc 在内存位置 0x0037c29c
我认为这与内存不足"有关.当我减少分配的金额时,它运行良好.
我的机器上有足够的内存 (16 GB),资源监视器显示 Visual Studio 只使用了其中的一小部分.我添加了编译器选项 /F 4000000000
和 /LARGEADDRESSAWARE
,但仍然出现错误.
如何解决?
您确定您的操作系统可以利用整个 16GB并且您使用的是 64 位版本的 VC++
http://msdn.microsoft.com/en-us/library/h2k70f3s%28v=vs.90%29.aspx
http://msdn.microsoft.com/en-us/library/9yb4317s%28v=vs.90%29.aspx
This line of code produces the following error
rs[se_idx][ev_idx][re_idx].trs = new re_class[report_size];
I think this is related to 'not enough memory'. When I decrease the amount being allocated, it runs fine.
I have plenty of memory (16 GB) on the machine and a resource monitor shows only a tiny fraction of it is being used by visual studio. I added the compiler options /F 4000000000
and /LARGEADDRESSAWARE
, but still getting the error.
How can this be solved?
Are you sure your operating system can take advantage of the entire 16GBand you're using a 64 bit version of VC++
http://msdn.microsoft.com/en-us/library/h2k70f3s%28v=vs.90%29.aspx
http://msdn.microsoft.com/en-us/library/9yb4317s%28v=vs.90%29.aspx
这篇关于Visual Studio 中的内存错误,但有足够的可用内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!