Scala编译期间内存不足错误

Scala编译期间内存不足错误,scala,sbt,shapeless,scala-pickling,Scala,Sbt,Shapeless,Scala Pickling,我正在使用大量的scala pickle宏以及shapeless,我不断地破坏scala 2.10.3编译器,导致明显的内存不足错误。 错误消息的尾部如下所示: [error] <tpt> // tree.tpe=tasks.anonfun$218 [error] Block( // tree.tpe=Unit [error] Apply( // def <init>(): scala.runtime.AbstractFunction1 in

我正在使用大量的
scala pickle
宏以及
shapeless
,我不断地破坏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
[error]//tree.tpe=tasks.anonfun$218
[错误]块(//tree.tpe=Unit
[错误]应用(//def():类AbstractFunction1的tree.tpe=scala.runtime.AbstractFunction1中的scala.runtime.AbstractFunction1
[错误]SimpleMiddlebury$$anonfun$218.super。“//def():类AbstractFunction1中的scala.runtime.AbstractFunction1,tree.tpe=()scala.runtime.AbstractFunction1
[错误]无
[错误])
[错误]()
[错误])
[错误])
[错误])
[错误]
[错误]==树的扩展类型==
[错误]
[错误]ConstantType(值=常量(anon$326))
[错误]
[错误]编译期间未捕获异常:java.io.IOException
[错误]无法分配内存
我正在监视我的系统内存,而且内存非常丰富,所以如果这真的是内存分配的问题,我猜我可以在某个地方设置一些JVM标志来消除这个问题

但是,我已经尝试通过将脚本中的堆设置调整为
-Xmx8g
来增加可用内存,但仍然出现了这个错误。 这是正确的旗帜吗

想法


编辑:我添加了“scala pickling”和“Shapess”标记,因为这些库的其他用户可能会遇到这种情况。

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


将此文件中的-Xss设置更新到更高的阈值。将其设置为-Xss8M足以解决我的不成形堆栈溢出编译问题

我相信您可以直接从脚本作者那里获得更好的支持。如果我有什么建议,请在paulp的sbt extras repo上提出一个问题。