How to set the size of the C stack in R?

梦想的初衷 提交于 2019-12-04 06:14:55

I encountered a similar situation, and in my case, I could increase the size of C Stack by setting the launchctl limit.

Before setting the launchctl limit:

> Cstack_info()
      size    current  direction eval_depth 
   7969177      17072          1         2

$ ulimit -s
stack size              (kbytes, -s) 8192

$ sudo launchctl limit
stack       8388608        67104768 

Setting the launchctl limit:

$ cd /Library/LaunchDaemons/
$ sudo vi limit.stack.plist # create a new plist file to set new stack value

<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>limit.maxfiles</string>
    <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>stack</string>
      <string>67104768</string>
      <string>67104768</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>ServiceIPC</key>
    <false/>
  </dict>
</plist>

After rebooting:

> Cstack_info()
      size    current  direction eval_depth 
   63749529      17072          1          2

$ ulimit -s
stack size              (kbytes, -s) 65532

$ sudo launchctl limit
stack       67104768       67104768  

R version 3.5.0
macOS High Sierra 10.13.5

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