问题
I am working on a Lift project and trying to compile it with scala:cc
and the scala compilation server using the jvm args:
-Xmx1024m -Xss20m -XX:PermSize=64M -XX:MaxPermSize=512M -XX:+CMSClassUnloadingEnabled -XX:+CMSClassUnloadingEnabled
The error also occurs with the jvm args:
-Xmx1024m -Xss20m -XX:PermSize=64M -XX:MaxPermSize=512M
The result is:
[INFO] Compiling 16 source files to /Users/axaluss/IdeaProjects/trunk/Team_Skynet/target/classes at 1299141180948
[ERROR] java.lang.OutOfMemoryError: Java heap space
[INFO] at scala.tools.nsc.symtab.Types$class.typeRef(Types.scala:2503)
[INFO] at scala.tools.nsc.symtab.SymbolTable.typeRef(SymbolTable.scala:13)
[INFO] at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:2828)
[INFO] at scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:3209)
[INFO] at scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:3085)
[INFO] at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:2849)
[INFO] at scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:3209)
[INFO] at scala.tools.nsc.symtab.Types$Type.asSeenFrom(Types.scala:507)
[INFO] at scala.tools.nsc.symtab.Types$Type.computeMemberType(Types.scala:531)
[INFO] at scala.tools.nsc.symtab.Symbols$MethodSymbol.typeAsMemberOf(Symbols.scala:1774)
[INFO] at scala.tools.nsc.symtab.Types$Type.memberType(Types.scala:522)
[INFO] at scala.tools.nsc.symtab.Types$Type.findMember(Types.scala:858)
[INFO] at scala.tools.nsc.symtab.Types$Type.nonPrivateMembers(Types.scala:453)
[INFO] at scala.tools.nsc.symtab.Types$class.lub0$1(Types.scala:4919)
[INFO] at scala.tools.nsc.symtab.Types$class.lub0$1(Types.scala:4873)
[INFO] at scala.tools.nsc.symtab.Types$class.lub(Types.scala:4943)
[INFO] at scala.tools.nsc.symtab.SymbolTable.lub(SymbolTable.scala:13)
[INFO] at scala.tools.nsc.symtab.Types$class.lubsym$1(Types.scala:4901)
[INFO] at scala.tools.nsc.symtab.Types$$anonfun$38.apply(Types.scala:4924)
[INFO] at scala.tools.nsc.symtab.Types$$anonfun$38.apply(Types.scala:4919)
[INFO] at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
[INFO] at scala.collection.immutable.List.foreach(List.scala:45)
[INFO] at scala.tools.nsc.symtab.Types$class.lub0$1(Types.scala:4919)
[INFO] at scala.tools.nsc.symtab.Types$class.lub(Types.scala:4943)
[INFO] at scala.tools.nsc.symtab.SymbolTable.lub(SymbolTable.scala:13)
[INFO] at scala.tools.nsc.symtab.Types$class.lub(Types.scala:4863)
[INFO] at scala.tools.nsc.symtab.SymbolTable.lub(SymbolTable.scala:13)
[INFO] at scala.tools.nsc.symtab.Types$class.solveOne$1(Types.scala:4675)
[INFO] at scala.tools.nsc.symtab.Types$$anonfun$solve$1.apply(Types.scala:4684)
[INFO] at scala.tools.nsc.symtab.Types$$anonfun$solve$1.apply(Types.scala:4683)
[INFO] at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
[INFO] at scala.collection.immutable.List.foreach(List.scala:45)
[ERROR] error: fatal error (server aborted): Java heap space
[ERROR] one error found
How can I solve this problem? I dont know what is causing this error and found anything on Google except increasing the memory.
回答1:
Obviously, you have to increase mx
. One problem Scala does have is its big memory consumption. With the widespread adoption of 64 bits CPUs and server OS, and the current surge in adoption of 64 bits desktop OS, I expect it won't be critical much longer.
回答2:
You can start with setting some debugging on the compiler to try to find out where this stems from: http://www.scala-lang.org/docu/files/tools/scalac.html
来源:https://stackoverflow.com/questions/5191359/why-am-i-getting-outofmemoryerror-compilation-error-in-scala