是否有在Linux进程的堆栈大小的限制 [英] Is there a limit of stack size of a process in linux

查看:744
本文介绍了是否有在Linux进程的堆栈大小的限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有的Linux 过程的大小有限制吗?难道仅仅依赖于机器的 RAM
我想,以限制递归调用的函数的深度知道这一点。

Is there a limit on the stack size of a process in Linux? Is it simply dependent on the RAM of the machine? I want to know this in order to limit the depth of recursive calls to a function.

感谢您。

推荐答案

堆栈通常是由资源限制的限制。您可以看到默认的设置是使用的ulimit -a 安装什么:

The stack is normally limited by a resource limit. You can see what the default settings are on your installation using ulimit -a:

stack size              (kbytes, -s) 8192

(这表明我的是8MB,这是巨大的)。

(this shows that mine is 8MB, which is huge).

如果您删除或增加限制,你仍然不能使用所有的RAM机器堆栈 - 堆栈从近进程的地址空间的顶部点向下生长,并在某些时候它将运行到code,堆或加载库。

If you remove or increase that limit, you still won't be able to use all the RAM in the machine for the stack - the stack grows downward from a point near the top of your process's address space, and at some point it will run into your code, heap or loaded libraries.

这篇关于是否有在Linux进程的堆栈大小的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆