2013-05-20 58 views
7

我使用SBT 0.12.3來測試一些代碼,並且通常在使用~test命令交互式測試時收到此錯誤消息。SBT內存不足

8. Waiting for source changes... (press enter to interrupt) 
[info] Compiling 1 Scala source to C:\Users\t\scala-projects\scala test\target\s 
cala-2.10\classes... 
sbt appears to be exiting abnormally. 
    The log file for this session is at C:\Users\t\AppData\Local\Temp\sbt566325905 
3150896045.log 
java.lang.OutOfMemoryError: PermGen space 
     at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source) 
     at java.util.concurrent.FutureTask.get(Unknown Source) 
     at sbt.ConcurrentRestrictions$$anon$4.take(ConcurrentRestrictions.scala: 
196) 
     at sbt.Execute.next$1(Execute.scala:85) 
     at sbt.Execute.processAll(Execute.scala:88) 
     at sbt.Execute.runKeep(Execute.scala:68) 
     at sbt.EvaluateTask$.run$1(EvaluateTask.scala:162) 
     at sbt.EvaluateTask$.runTask(EvaluateTask.scala:177) 
     at sbt.Aggregation$$anonfun$4.apply(Aggregation.scala:46) 
     at sbt.Aggregation$$anonfun$4.apply(Aggregation.scala:44) 
     at sbt.EvaluateTask$.withStreams(EvaluateTask.scala:137) 
     at sbt.Aggregation$.runTasksWithResult(Aggregation.scala:44) 
     at sbt.Aggregation$.runTasks(Aggregation.scala:59) 
     at sbt.Aggregation$$anonfun$applyTasks$1.apply(Aggregation.scala:31) 
     at sbt.Aggregation$$anonfun$applyTasks$1.apply(Aggregation.scala:30) 
     at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.sca 
la:62) 
     at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.sca 
la:62) 
     at sbt.Command$.process(Command.scala:90) 
     at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(MainLoop.scala:71 
) 
     at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(MainLoop.scala:71 
) 
     at sbt.State$$anon$2.process(State.scala:170) 
     at sbt.MainLoop$$anonfun$next$1.apply(MainLoop.scala:71) 
     at sbt.MainLoop$$anonfun$next$1.apply(MainLoop.scala:71) 
     at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18) 
     at sbt.MainLoop$.next(MainLoop.scala:71) 
     at sbt.MainLoop$.run(MainLoop.scala:64) 
     at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:53) 
     at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:50) 
     at sbt.Using.apply(Using.scala:25) 
     at sbt.MainLoop$.runWithNewLog(MainLoop.scala:50) 
     at sbt.MainLoop$.runAndClearLast(MainLoop.scala:33) 
     at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:17) 
Error during sbt execution: java.lang.OutOfMemoryError: PermGen space 

的錯誤是明顯的,我雲增加堆大小,它可能會停止拋出的錯誤,但事情是,它的一些後關閉(我不知道有多少)測試的互動與代碼中的最小變化,以及如果堆中的簡單增加可以解決問題,或者必須執行額外的工作而不會耗盡內存。

在此先感謝。

回答

5

如果你還沒有,嘗試給你的sbt.bat更多的PermGen空間。我不在Windows上運行sbt,但我給java -Xmx1512M -XX:MaxPermSize=512M。嘗試另一件事可能是在測試過程中叉:http://www.scala-sbt.org/release/docs/Detailed-Topics/Testing#forking-tests

在0.12.0版本中,增加運行在一個單獨的JVM測試設施。設置

fork in Test := true 

規定,所有測試都將在一個外部JVM中執行。