SBT 内存不足 [英] SBT runs out of memory

查看:57
本文介绍了SBT 内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SBT 0.12.3 测试一些代码,并且经常在使用 ~test 命令进行交互测试时收到此错误消息.

<代码>8.等待源更改...(按回车键中断)[信息] 将 1 个 Scala 源代码编译到 C:Users	scala-projectsscala test	argetscala-2.10类...sbt 似乎异常退出.此会话的日志文件位于 C:Users	AppDataLocalTempsbt5663259053150896045.logjava.lang.OutOfMemoryError: PermGen 空间在 java.util.concurrent.FutureTask$Sync.innerGet(未知来源)在 java.util.concurrent.FutureTask.get(未知来源)在 sbt.ConcurrentRestrictions$$anon$4.take(ConcurrentRestrictions.scala:196)在 sbt.Execute.next$1(Execute.scala:85)在 sbt.Execute.processAll(Execute.scala:88)在 sbt.Execute.runKeep(Execute.scala:68)在 sbt.EvaluateTask$.run$1(EvaluateTask.scala:162)在 sbt.EvaluateTask$.runTask(EvaluateTask.scala:177)在 sbt.Aggregation$$anonfun$4.apply(Aggregation.scala:46)在 sbt.Aggregation$$anonfun$4.apply(Aggregation.scala:44)在 sbt.EvaluateTask$.withStreams(EvaluateTask.scala:137)在 sbt.Aggregation$.runTasksWithResult(Aggregation.scala:44)在 sbt.Aggregation$.runTasks(Aggregation.scala:59)在 sbt.Aggregation$$anonfun$applyTasks$1.apply(Aggregation.scala:31)在 sbt.Aggregation$$anonfun$applyTasks$1.apply(Aggregation.scala:30)在 sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.sca拉:62)在 sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.sca拉:62)在 sbt.Command$.process(Command.scala:90)在 sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(MainLoop.scala:71)在 sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(MainLoop.scala:71)在 sbt.State$$anon$2.process(State.scala:170)在 sbt.MainLoop$$anonfun$next$1.apply(MainLoop.scala:71)在 sbt.MainLoop$$anonfun$next$1.apply(MainLoop.scala:71)在 sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)在 sbt.MainLoop$.next(MainLoop.scala:71)在 sbt.MainLoop$.run(MainLoop.scala:64)在 sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:53)在 sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:50)在 sbt.Using.apply(Using.scala:25)在 sbt.MainLoop$.runWithNewLog(MainLoop.scala:50)在 sbt.MainLoop$.runAndClearLast(MainLoop.scala:33)在 sbt.MainLoop$.runLoggedLoop(MainLoop.scala:17)sbt 执行期间出错:java.lang.OutOfMemoryError: PermGen space

错误很明显,我增加了堆大小,它可能会停止抛出该错误,但问题是它在进行了一些(我不知道有多少)测试交互后关闭,并且变化很小代码,以及如果简单地增加堆就可以解决问题,或者我是否必须做额外的工作才能避免内存不足.

提前致谢.

解决方案

如果还没有,请尝试在 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 中执行.

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:Users	scala-projectsscala test	argets
cala-2.10classes...
sbt appears to be exiting abnormally.
  The log file for this session is at C:Users	AppDataLocalTempsbt566325905
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.

解决方案

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.

这篇关于SBT 内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆