Hi.
I do a memory allocation using 'new', as follow.
double *myarray[50];
for (int j = 0; j < 50; j++)
myarray[j] = new double[100000];
double *myarray[50];
for (int j = 0; j < 50; j++)
myarray[j] = new double[100000];
To copy to clipboard, switch view to plain text mode
When the codes first run it works. When I rerun it, (e.g. when user click the button again) the program crash. I tried to debug but couldnt find an answer. What is the right way to "trap" such memory allocation codes in QT? And is there a better way to allocate an array of pointers to double in QT?
I also delete the allocation as needed by the following codes
for (int j = 0; j < 50; j++)
delete [] myarray[j]
for (int j = 0; j < 50; j++)
delete [] myarray[j]
To copy to clipboard, switch view to plain text mode
Thanks!
Bookmarks