How to increase stack size for a ruby app. Recursive app getting: Stack level too deep (SystemStackError)

前端 未结 7 1832
感情败类
感情败类 2020-11-30 02:53

Posting a stack overflow question on stackoverflow.com, how amusing :-)

I\'m running some recursive Ruby code and I get the: \"Stack level too deep (SystemStac

7条回答
  •  执笔经年
    2020-11-30 03:46

    Ruby uses the C stack so your options include using ulimit or compiling Ruby with some compiler/linker stack size flag. Tail recursion is yet to be implemented and Ruby's current support for recursion isn't so great. As cool and elegant recursion is, you might want to consider coping with the language's limitations and writing your code in a different way.

提交回复
热议问题