Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

heap - SBT runs out of memory

I am using SBT 0.12.3 to test some code and often I get this error message while testing interactively with the ~test command.

8. Waiting for source changes... (press enter to interrupt)
[info] Compiling 1 Scala source to C:Usersscala-projectsscala testargets
cala-2.10classes...
sbt appears to be exiting abnormally.
  The log file for this session is at C:UsersAppDataLocalTempsbt566325905
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

The error is clear, I cloud increase the heap size and it may stop throwing that error, but the thing is that it shuts down after a number(I don't know how many) of test interactions with a minimal change in the code, and if a simple increase in the heap would solve the problem or do I have to do additional work not to run out of memory.

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you haven't, try giving more PermGen space in your sbt.bat. I don't run sbt on Windows, but I give java -Xmx1512M -XX:MaxPermSize=512M. Another thing to try may be to fork during testing: http://www.scala-sbt.org/release/docs/Detailed-Topics/Testing#forking-tests

In version 0.12.0, the facility to run tests in a separate JVM was added. The setting

fork in Test := true

specifies that all tests will be executed in a single external JVM.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...