Segfault when allocating large array in Fortran

我是研究僧i 提交于 2019-12-14 03:13:54

问题


I have a very simple example of a strange segfault I am having and it is as follows:

program big_array_segfault

  integer :: nX = 13000
  integer :: nY = 100000
  real(kind = 8), allocatable :: bigarr(:,:)

  allocate(bigarr(nX, nY))

end program big_array_segfault

Note that I have 20 GB of RAM to work with and this does not even begin to approach that. Everything I have seen online suggests that this may be a problem with Stack space vs Heap space but I don't know how to control the memory in that way using Fortran.

For what it is worth, the I am compiling with gfortran -o big_arr.exe test.f90 so there is nothing special going on in the compilation.

来源:https://stackoverflow.com/questions/20478946/segfault-when-allocating-large-array-in-fortran

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!