微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

scala – sbt heapsize还不够?

当我尝试编译 scalala时,我得到一个OutOfMemoryError:

> compile
[info] 
[info] == compile ==
[info]   Source analysis: 127 new/modified,0 indirectly invalidated,0 removed.
[info] Compiling main sources...
[info] == compile ==
java.lang.OutOfMemoryError: Java heap space
    at scala.Tuple2$Zipped.map(Tuple2.scala:63)
    at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3134)
    at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3024)
    at scala.tools.nsc.symtab.Types$SubstMap.apply(Types.scala:3455)
    at scala.tools.nsc.symtab.Types$Type.subst(Types.scala:580)
    at scala.tools.nsc.symtab.Types$Type.instantiateTypeParams(Types.scala:421)
    at scala.tools.nsc.typechecker.Infer$Inferencer.exprTypeArgs(Infer.scala:449)
    at scala.tools.nsc.typechecker.Infer$Inferencer.inferExprInstance(Infer.scala:1103)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:738)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:732)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:484)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:449)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:376)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$Implicitcomputation.tryImplicitInfo$1(Implicits.scala:668)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$Implicitcomputation.rankImplicits(Implicits.scala:671)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$Implicitcomputation.findBest(Implicits.scala:695)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:753)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.implicitManifestOrOfExpectedType(Implicits.scala:1069)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1096)
    at scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:57)
    at scala.tools.nsc.Global$analyzer$.inferImplicit(Global.scala:347)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:120)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:115)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:115)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:760)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:732)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:484)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:449)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:376)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$Implicitcomputation.tryImplicitInfo$1(Implicits.scala:668)
Error during sbt execution: java.lang.OutOfMemoryError: Java heap space
Exception in thread "Poller SunPKCS11-Darwin" java.lang.OutOfMemoryError: Java heap space
    at sun.security.pkcs11.wrapper.PKCS11.C_GetSlotInfo(Native Method)
    at sun.security.pkcs11.SunPKCS11.initToken(SunPKCS11.java:767)
    at sun.security.pkcs11.SunPKCS11.access$100(SunPKCS11.java:42)
    at sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:700)
    at java.lang.Thread.run(Thread.java:680)

{/Users/axaluss/LIBRARIES/scalala-Scalala-f2876c8/scalala-Scalala-f2876c8}
###[ axaluss ]:

我对SBT了解不多,所以我不知道我做错了什么.
sbt文件我改为:

java $SBT_OPTS -Dfile.encoding=UTF-8 -Xss4M -Xmx1024M -XX:MaxPermSize=1024M -XX:NewSize=512M -XX:NewRatio=3 -jar `dirname $0`/project/sbt-launch-0.7.5.jar "$@"

Build.properties:

#Project properties
#Mon Apr 11 02:52:55 PDT 2011
project.organization=org.scalala
project.name=scalala
sbt.version=0.7.4
project.version=1.0.0.RC2-SNAPSHOT
def.scala.version=2.9.0
build.scala.versions=2.9.0
project.initialize=false

编译scala 2.8.1时出现同样的问题.

我怎样才能编译scalala?

谢谢你的帮助!

解决方法

尝试增加堆大小,在sbt put中:

-Xmx1524M

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐