how to speed up the deletion of multidimensional array in C++

Joined
Oct 4, 2010
Messages
1
Reaction score
0
Hi everyone, this is my first post. I'm writing a value-iteration algorithm to solve a MDP problem for my research. In my algorithm, I have to change the parameters when I search for the optimal solution. Therefore, I had to use variable size multi-dimensional array and resize the arrays at the beginning of each iteration. I used new[] to construct my arrays. I have one 3D array, a few 2D arrays and a few 1D arrays. I'm using delete[] with loop to delete the arrays at the end of each iteration. However, since the size of my arrays are pretty big, (the 3D array is around [10000 * 10000 * 3] and some of my 2D arrays are around [20000 * 10000] ), when I delete the arrays, it takes around 20 to 30 min. (my desktop is i7 with 6G of 1600 DDR3 ram). I've used visual studio 2010 ultimate with 64bit complier to utilize my RAM. Since I might need to run 10K iterations , the program will take forever to run. Is there any way to speed up the array deletion process? Should I be using vectors instead of new[] to create multidimensional arrays?
Thanks in advance!

William
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top