sbt heapsize not enough?
When i try to compile scalala i get a 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)
开发者_JAVA百科 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 ]:
I dont know much about SBT so I dont know what I am doing wrong. The sbt file I changed to:
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
The same problem occured when compiling for scala 2.8.1.
How can I manage to compile scalala?
Thanks for any help!
Try to increase heap size a bit, in sbt put:
-Xmx1524M
sbt
command can read JAVA_OPTS or SBT_OPTS environment variable. Co you can try:
$ JAVA_OPTS=-Xmx1524M
If that doesn't work and you are using OpenJDK on a Linux based OS, then you can also try this:
# echo 1 > /proc/sys/vm/overcommit_memory
Just setting SBT_OPTS
may not work as the JAVA_OPTS
appear after those and at least my java version "1.7.0_80"
uses the last flag to set the heapsize.
精彩评论