free array of array extremely slow
i ve created an array of array, and it is VERY fast to allocate with new.
however, when freeing it with delete, it takes up to 1 minute! i can actually see the size decreasing slowly in the Page File Usage History of the Windows Task Manager (whereas when created it is an almost instant jump in memory size)
this is the freeing code: (in a destructor)
i m using MSVC++ .NET version.
for (register unsigned short int i = 0; i < wZ; i++)
//free the columns of row j, slice i
for (register unsigned short int j = 0; j < wY; j++)
//free the rows of slice i
i ve been suggested that this could be because the compiler kinds of defragments the memory everytime it frees just one column, whitout realizing that it would eventually free the WHOLE thing anyway...
any idea to make the delete faster (i hope as fast as when created with new)
thanks a lot!