I am trying to allocate an real array finn_var(459,299,27,24,nspec) in Fortran. nspec = 24 works ok, while nspec = 25 not. No error message for allocation process, but print
It doesn't have to be insufficient memory. The size of the array is 2 223 304 200
. That is suspiciously close to the maximum 32bit integer 2 147 483 648
.
It looks like that the element count that the compiler uses internally overflows. The internal call to malloc
requests not enough memory and then any attempt to read some of the elements at the end fails.
It is a limitation of the compiler in its default settings. It can be set-up to use 64bit addressing by using the option ‑Mlarge_arrays
.
See http://www.pgroup.com/products/freepgi/freepgi_ref/ch05.html#ArryIndex
Your problem is most likely a memory issue.
You array demands 459*299*27*24 * 4B
per nspec
(assuming default real
requires 4B
of memory). For nspec == 24
this results in a memory requirement of approximately 7.95GiB
, while nspec == 25
needs around 8.28GiB
.
I guess, your physical memory is limited to 8GiB
or some ulimit
limits the amount of allowed memory for this process.