堆栈溢出从Java深层递归? [英] Stack overflows from deep recursion in Java?
问题描述
有没有办法让调用堆栈更大?像我可以让数百万通话深度的函数一样,比如Erlang?
当我执行Project Euler问题时,我越来越注意到这一点。
谢谢。
我猜你可以使用这些参数。 b
$ b
-ss Stacksize增加本地
堆栈大小或
-oss Stacksize to增加Java
堆栈大小,
默认的本地堆栈大小为128k,
,最小值为1000字节。
默认的Java堆栈大小为400k,最小值为1000字节的
。
http://edocs.bea.com/wls/docs61/faq/java.html# 251197
编辑:
在阅读第一条评论(Chuck's)之后,当重读这个问题并阅读另一个答案时,我想澄清一下,我将问题解释为增加堆栈大小。我没有打算说你可以有无限的堆栈,比如在函数式编程中(一种编程范式,我只是在它的表面上划过)。
After some experience with functional languages, I'm starting to use recursion more in Java - But the language seems to have a relatively shallow call stack of about 1000.
Is there a way to make the call stack bigger? Like can I make functions that are millions of calls deep, like in Erlang?
I'm noticing this more and more when I do Project Euler problems.
Thanks.
I guess you could use these parameters
-ss Stacksize to increase the native stack size or
-oss Stacksize to increase the Java stack size,
The default native stack size is 128k, with a minimum value of 1000 bytes. The default java stack size is 400k, with a minimum value of 1000 bytes.
http://edocs.bea.com/wls/docs61/faq/java.html#251197
EDIT:
After reading the first comment (Chuck´s), as well as re reading the question and reading another answers, i´d like to clarify that i interpreted the question as just "increase stack size". I didn´t intend to say that you can have infinite stacks, such as in functional programming (a programming paradigm which i´ve only scratched its surface).
这篇关于堆栈溢出从Java深层递归?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!