I am writing a program to test a feature. However, I get an error when I declare a boost::multi_array that has a certain size. I get the following error:
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
My code looks like this:
#include <boost/multi_array.hpp>
#include <boost/array.hpp>
boost::multi_array<double,3> test ;
test.resize( boost::extents[1000][1000][1000] ) ;
I get don't get the error if I declare a 2D multi_array or if I declare a 3D multi_array with a size of 10x10x10 and 100x100x100.
Does anyone has any idea to fix this? Is this problem compiler related or something?
I executed the code using Qt creator and I use the MinGW compiler.
Later in my project I will use arrays with a dimension of 12/13 and each dimension will have a length between 100 and 1000, so I really need this to work.
Thanks in advance!
RAM Memory exceeded.
double takes up 8 bytes -> 1000x1000x1000 doubles = 8 gigabytes of required RAM.