问题
This line of code produces the following error
rs[se_idx][ev_idx][re_idx].trs = new re_class[report_size];
std::bad_alloc at memory location 0x0037c29c
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?
回答1:
Are you sure your operating system can take advantage of the entire 16GB and 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
来源:https://stackoverflow.com/questions/10554876/memory-error-in-visual-studio-but-plenty-of-memory-available