A
Atemporal
hi, all, i got some problem when define and use large dynamic two
dimension arrays.
At first, i use vector<vector<double>> p1, i have three such arrays
and each is around 10000*10000, the program compiles ok, however, when
it gets following error when running
Unhandled exception at 0x7c812aeb in Value.exe: Microsoft C++
exception: std::bad_alloc at memory location 0x0013f988..
Then I turn to use the "new" method like the follows,
double **Profit1;
double **Profit2;
double **qq;
Profit1 = new double*[n1+1];
Profit2 = new double*[n1+1];
qq = new double*[n1+1];
for(int i=0;i<=n1;i++)
{
std::cout << i << std::endl;
Profit1 = new double[n2+1];
Profit2 = new double[n2+1];
qq = new double[n2+1];
}
I still get the similar error.
What shall I do?
As I'm a newbie, please answer my question in a little more details,
thanks a lot.
dimension arrays.
At first, i use vector<vector<double>> p1, i have three such arrays
and each is around 10000*10000, the program compiles ok, however, when
it gets following error when running
Unhandled exception at 0x7c812aeb in Value.exe: Microsoft C++
exception: std::bad_alloc at memory location 0x0013f988..
Then I turn to use the "new" method like the follows,
double **Profit1;
double **Profit2;
double **qq;
Profit1 = new double*[n1+1];
Profit2 = new double*[n1+1];
qq = new double*[n1+1];
for(int i=0;i<=n1;i++)
{
std::cout << i << std::endl;
Profit1 = new double[n2+1];
Profit2 = new double[n2+1];
qq = new double[n2+1];
}
I still get the similar error.
What shall I do?
As I'm a newbie, please answer my question in a little more details,
thanks a lot.