1

我正在使用大量宏scala-picklingshapeless,并且我不断使 Scala 2.10.3 编译器崩溃,并出现明显的内存不足错误。错误消息的尾部如下所示:

[error]     <tpt> // tree.tpe=tasks.anonfun$218
[error]     Block( // tree.tpe=Unit
[error]       Apply( // def <init>(): scala.runtime.AbstractFunction1 in class AbstractFunction1, tree.tpe=scala.runtime.AbstractFunction1
[error]         SimpleMiddlebury$$anonfun$218.super."<init>" // def <init>(): scala.runtime.AbstractFunction1 in class AbstractFunction1, tree.tpe=()scala.runtime.AbstractFunction1
[error]         Nil
[error]       )
[error]       ()
[error]     )
[error]   )
[error] )
[error] 
[error] == Expanded type of tree ==
[error] 
[error] ConstantType(value = Constant(anon$326))
[error] 
[error] uncaught exception during compilation: java.io.IOException
[error] Cannot allocate memory

我正在监视我的系统内存,而且内存很多,所以如果这真的是内存分配的问题,我猜我可以在某个地方设置一些 JVM 标志来解决问题。

但是,我尝试通过将paulp 的 sbt脚本中的堆设置调整为 来增加可用内存,但-Xmx8g我仍然收到此错误。这是正确的标志吗?

想法?

编辑:我添加了“scala-pickling”和“shapeless”标签,因为这是这些库的其他用户可能遇到的。

4

1 回答 1

2

在您的 sbt 安装目录中有一个文件 ./bin/sbt

将此文件中的 -Xss 设置更新为更高的阈值。将其设置为 -Xss8M 足以让我的无形堆栈溢出编译问题消失

于 2018-04-19T23:09:04.063 回答