我正在研究一个Lift项目,并尝试使用jvm args与scala:cc和scala编译服务器进行编译:
-Xmx1024m -Xss20m -XX:PermSize=64M -XX:MaxPermSize=512M -XX:+CMSClassUnloadingEnabled -XX:+CMSClassUnloadingEnabled
jvm args也会发生此错误:
-Xmx1024m -Xss20m -XX:PermSize=64M -XX:MaxPermSize=512M
结果是:
[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
我怎么解决这个问题?
我不知道是什么原因导致此错误,并在Google上发现了任何东西,但增加了内存.
解决方法:
显然,您必须增加mx. Scala确实存在的一个问题是其大量的内存消耗.随着64位CPU和服务器OS的广泛采用,以及当前64位台式机OS的采用激增,我预计它将不再是关键.