什么是 Linux 堆栈?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8905271/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the Linux Stack?
提问by jaredonline
I recently ran into a bug with the "linux stack" and the "linux stack size". I came across a blog directing me to try
我最近遇到了“linux 堆栈”和“linux 堆栈大小”的错误。我遇到了一个博客,指导我尝试
ulimit -a
to see what the limit for my box was, and it was set to 8192kb
which seems to be the default.
看看我的盒子的限制是多少,它被设置为8192kb
似乎是默认值。
What is the "linux stack"? How does it work, what does it store, what does it do?
什么是“Linux 堆栈”?它是如何工作的,它存储什么,它有什么作用?
采纳答案by nycynik
The short answer is:
简短的回答是:
When programs on your linux box run, they add and remove data from the stackon a regular basis as the programs function. The stack size, referes to how much space is allocated in memory for the stack. If you increase the stack size, that allows the program to increase the number of routines that can be called. Each time a function is called, data can be added to the stack (stacked on top of the last routines data.)
当您的 linux 机器上的程序运行时,它们会随着程序的运行定期从堆栈中添加和删除数据。栈大小,是指在内存中为栈分配了多少空间。如果增加堆栈大小,则允许程序增加可以调用的例程数量。每次调用函数时,都可以将数据添加到堆栈中(堆叠在最后一个例程数据的顶部。)
Unless the program is a very complex, or designed for a special purpose, a stack size of 8192kb is normally fine. Some programs like graphics processing programs require you to increase the size of the stack to function. As they may store a lot of data on the stack.
除非程序非常复杂,或者为特殊目的而设计,否则 8192kb 的堆栈大小通常是可以的。某些程序(如图形处理程序)需要您增加堆栈的大小才能运行。因为它们可能会在堆栈上存储大量数据。
Feel free to increase the stack size for those applications, its not a problem. To do so, use
随意增加这些应用程序的堆栈大小,这不是问题。为此,请使用
ulimit -s bytes
ulimit -s bytes
BTW, What is a StackOverflowError?
顺便说一句,什么是 StackOverflowError?