Setting stacksize in a python script

前端 未结 4 1150
梦谈多话
梦谈多话 2020-11-27 07:05

I am converting a csh script to a python script. The script calls a memory-intensive executable which requires a very large stack, so the csh script sets the stacksize to un

4条回答
  •  渐次进展
    2020-11-27 07:31

    You can just use the (u)limit command of your shell, if you want:

    os.system('ulimit -s unlimited; some_executable')
    

    Or (probably better) use resource.setrlimit:

    resource.setrlimit(resource.RLIMIT_STACK, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
    

提交回复
热议问题