• <legend id='hKhbL'><style id='hKhbL'><dir id='hKhbL'><q id='hKhbL'></q></dir></style></legend>
      <bdo id='hKhbL'></bdo><ul id='hKhbL'></ul>
    <i id='hKhbL'><tr id='hKhbL'><dt id='hKhbL'><q id='hKhbL'><span id='hKhbL'><b id='hKhbL'><form id='hKhbL'><ins id='hKhbL'></ins><ul id='hKhbL'></ul><sub id='hKhbL'></sub></form><legend id='hKhbL'></legend><bdo id='hKhbL'><pre id='hKhbL'><center id='hKhbL'></center></pre></bdo></b><th id='hKhbL'></th></span></q></dt></tr></i><div id='hKhbL'><tfoot id='hKhbL'></tfoot><dl id='hKhbL'><fieldset id='hKhbL'></fieldset></dl></div>

    1. <small id='hKhbL'></small><noframes id='hKhbL'>

    2. <tfoot id='hKhbL'></tfoot>

        在 python 脚本中设置堆栈大小

        Setting stacksize in a python script(在 python 脚本中设置堆栈大小)
        <tfoot id='ooHLA'></tfoot>

        <small id='ooHLA'></small><noframes id='ooHLA'>

          <bdo id='ooHLA'></bdo><ul id='ooHLA'></ul>
          <legend id='ooHLA'><style id='ooHLA'><dir id='ooHLA'><q id='ooHLA'></q></dir></style></legend>

              <tbody id='ooHLA'></tbody>

            <i id='ooHLA'><tr id='ooHLA'><dt id='ooHLA'><q id='ooHLA'><span id='ooHLA'><b id='ooHLA'><form id='ooHLA'><ins id='ooHLA'></ins><ul id='ooHLA'></ul><sub id='ooHLA'></sub></form><legend id='ooHLA'></legend><bdo id='ooHLA'><pre id='ooHLA'><center id='ooHLA'></center></pre></bdo></b><th id='ooHLA'></th></span></q></dt></tr></i><div id='ooHLA'><tfoot id='ooHLA'></tfoot><dl id='ooHLA'><fieldset id='ooHLA'></fieldset></dl></div>

                • 本文介绍了在 python 脚本中设置堆栈大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在将 csh 脚本转换为 python 脚本.该脚本调用了一个需要非常大堆栈的内存密集型可执行文件,因此 csh 脚本将堆栈大小设置为无限制:

                  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 unlimited:

                  limit stacksize unlimited
                  

                  当我尝试在 python 中重现这个脚本时,我以一种非常幼稚的方式执行它们,使用 os.system,例如:

                  When I try to reproduce this script in python, I execute them in a very naive manner, using os.system, e.g.:

                  os.system('some_executable')
                  

                  但我不知道如何告诉操作系统以无限堆栈大小运行这些可执行文件.有没有办法为 python 脚本中的调用指定堆栈大小?我应该使用一些低级系统调用吗?是否有一个模块(类似于shutil)来控制它?

                  But I do not know how to tell the OS to run these executables with unlimited stacksize. Is there a way to specify stacksize for calls within a python script? Is there some low-level system call that I should be using? And is there a module (similar to shutil) which controls this?

                  推荐答案

                  如果需要,您可以使用 shell 的 (u)limit 命令:

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

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

                  或者(可能更好)使用 resource.setrlimit:

                  Or (probably better) use resource.setrlimit:

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

                  这篇关于在 python 脚本中设置堆栈大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                  Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                  python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                  Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                  How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                  Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)
                  <legend id='MW3X6'><style id='MW3X6'><dir id='MW3X6'><q id='MW3X6'></q></dir></style></legend>

                    <small id='MW3X6'></small><noframes id='MW3X6'>

                  1. <i id='MW3X6'><tr id='MW3X6'><dt id='MW3X6'><q id='MW3X6'><span id='MW3X6'><b id='MW3X6'><form id='MW3X6'><ins id='MW3X6'></ins><ul id='MW3X6'></ul><sub id='MW3X6'></sub></form><legend id='MW3X6'></legend><bdo id='MW3X6'><pre id='MW3X6'><center id='MW3X6'></center></pre></bdo></b><th id='MW3X6'></th></span></q></dt></tr></i><div id='MW3X6'><tfoot id='MW3X6'></tfoot><dl id='MW3X6'><fieldset id='MW3X6'></fieldset></dl></div>
                      <bdo id='MW3X6'></bdo><ul id='MW3X6'></ul>
                    • <tfoot id='MW3X6'></tfoot>
                        <tbody id='MW3X6'></tbody>