Setting stacksize in a python script

前端 未结 4 1159
梦谈多话
梦谈多话 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:19

    You're looking for the Python setrlimit interface, resource.RLIMIT_STACK.

    Note that standard users cannot raise their hard limits, only root (well, a process with the CAP_SYS_RESOURCE capability (see capabilities(7)) processes can raise their limits; so you may need to use the PAM pam_limits(8) limits.conf(5) file to raise the hard limits for the users in question.

提交回复
热议问题