问题描述
在使用函数式语言的一些经验后,我开始在Java中更多地使用递归 - 但是这种语言似乎有一个相对较浅的调用堆栈,大约有1000个。有没有办法让调用堆栈更大?像我可以让数百万通话深度的函数一样,比如Erlang?
当我执行Project Euler问题时,我越来越注意到这一点。
谢谢。
我猜你可以使用这些参数。 b
$ b
编辑:
在阅读第一条评论(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
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深层递归?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!