When I run the following code I get a stack overflow. How is it possible? I thought if I define an array outside of main it will be static and I won't have memory problems? What can I do against it?
#include <stdio.h> #define dim1 14001 #define dim2 14001 #define dim4 8 double large_array[dim1][dim2][dim4]; int main() { large_array[30][6][5] = 1337; printf("%lf\t",large_array[30][6][5]); }
doubleis 8 bytes longdoubleis bigger than one byte.mmapit and page in the parts you need as you need them (slow). Alternatively rent yourself some time on AWS x.large compute node at $0.60/hr :)