开发者

How to increase scala stack size?

开发者 https://www.devze.com 2023-03-18 10:58 出处:网络
I am getting a java.lang.StackOverflowError, when I execute a Scala program. I believe that the stack size can be set with -DXss=n, but it does not work

I am getting a java.lang.StackOverflowError, when I execute a Scala program.

I believe that the stack size can be set with -DXss=n, but it does not work on my system:

  Scala compiler version 2.7.7final and
  Linux 2.6.38-8-generic #42-Ubuntu 

The attached program witnesses the problem on my system.

// scalac StackOverflow.scala
// scala StackOverflow 6000
// scala 开发者_高级运维-DXms=200M -DXmx=200M -DXss=200M StackOverflow 6000

object StackOverflow {
  def recur(k: Double): Double = {
    // check effects of various commands
    println(k)
    // try to prevent tail recursion
    if (k>0) return recur(k-1)+k/(k+1)
    else return 0.0
  }
  def main(args: Array[String]) {
    if (args.length == 0) println("Missing argument");
    val k = args(0).toInt+0.1
    recur(k)
  }
}

Sergio


I think what you want is scala -J-Xss200m

0

精彩评论

暂无评论...
验证码 换一张
取 消