Hello,
I am working on a program which creates a large pointer array of numbers and then performs several iterations of operations in them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int * u = newint[N];
double * nu = newdouble[N];
int * nud = newint[N];
for (int i=0;i<M;i++){
for (int i=0;i<N;i++){
u[i]=0;
nu[i]=0;
nud[i]=0;
}
(perform some operations on nu and nud, increment a counter)
}
If M is small enough then there are no problems in the program. However once M is large enough I get the "unhanded exception":
std::bad_alloc at memory location 0x0026f728..
Since I am just reusing the same arrays, and since I am able to make it through more than one iteration, I didn't think it could be a memory issue. If it is, is there a way I can clear the data completely after each iteration?