Allocating a number of large 3d arrays in C
I'm trying to allocate around 30 3d arrays of size 300*300*300.
I've tried allocating them statically, i.e.:
With this method I get a crash (upon execution) when I allocate the 1st array.
I have better results allocating the arrays dynamically:
With the above I can allocate around 15 arrays before the execution crashes.
float*** dx ;
dx=malloc(xSize*sizeof *dx );//Allocate 'xSize' pointer-to-pointer of int
dx[ x ] = malloc(ySize* sizeof **dx);//Allocate 'ySize' pointers of int
dx[ x ][ y ]= malloc(zSize* sizeof ***dx);//Allocate 'zSize' ints
I'm using the Eclipse CDT IDe and the GNU compiler.
I have the program coded in Matlab already but I wanted to code it in C to compare speeds.
Has anyone any experience with working with large datasets in C such as this and could they point me in the right direction?