I am coding some c++ lines to create a float array t[679][679][432][586] to store float values, I compile using g++ -mcmodel=medium my_code.c -o my_code.out
and that compiles well, but when executing with ./my_code.out 'option1' 'option2'
I get the error segmentation fault
, I think its related to lot of memory needed to be allocated for this long array (I have 8 Gb of ram), so if it is the case: please help me with the best solution to optimize the amount of memory needed or if 16 Gb of ram will help I can extend it. If there is an other potential origin of this error please let me know.
Martin