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.Code:float dx[xSize][ySize][zSize];
I have better results allocating the arrays dynamically:
With the above I can allocate around 15 arrays before the execution crashes.Code:float*** dx ; dx=malloc(xSize*sizeof *dx );//Allocate 'xSize' pointer-to-pointer of int for(x=0;x<xSize;x++) { dx[ x ] = malloc(ySize* sizeof **dx);//Allocate 'ySize' pointers of int for(y=0;y<ySize;y++) { 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?



LinkBack URL
About LinkBacks




