I have a problem. I need to allocate few very large fields with billions of float elements.
At the moment I'm using:
float ****spaceE;
int x,y,z;
x = y = z = 100;
spaceE = (float****)malloc(x*sizeof(int));
for (int i=0; i<x; i++)
{
spaceE[i] = (float***)malloc(y*sizeof(int));
for(int j=0; j<y; j++)
{
spaceE[i][j] = (float**)malloc(z*sizeof(int));
for(int k=0; k<z; k++)
{
spaceE[i][j][k] = (float*)malloc(size[3]*sizeof(float));
}
}
}
But it eats over 2GB of memory and Windows terminates it. I need to have few arrays like this and much bigger, is there any better way of doing this?