执行 Lift 项目时使用 SBT 出现内存不足错误
我正在使用 SBT 0.7.7。当我对 Lift 项目进行更改并通过以下方式重新编译时:
jetty-stop
compile
jetty-run
我收到以下错误:
sbt执行期间出错:java.lang.OutOfMemoryError: PermGen space
我在 /opt/local/bin/sbt-0.7 中定义了以下内容:
# Is the location of the SBT launcher JAR file.
LAUNCHJAR="/opt/local/share/sbt-0.7/sbt-launch-0.7.7.jar"
# Ensure enough heap space is created for SBT.
if [ -z "$JAVA_OPTS" ]; then
JAVA_OPTS="-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M"
fi
# Assume java is already in the shell path.
exec java $JAVA_OPTS -jar "$LAUNCHJAR" "$@"
I am using SBT 0.7.7. When I make a change to my Lift project and re-compile via:
jetty-stop
compile
jetty-run
I get the following error:
Error during sbt execution: java.lang.OutOfMemoryError: PermGen space
I have the following defined inside /opt/local/bin/sbt-0.7:
# Is the location of the SBT launcher JAR file.
LAUNCHJAR="/opt/local/share/sbt-0.7/sbt-launch-0.7.7.jar"
# Ensure enough heap space is created for SBT.
if [ -z "$JAVA_OPTS" ]; then
JAVA_OPTS="-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M"
fi
# Assume java is already in the shell path.
exec java $JAVA_OPTS -jar "$LAUNCHJAR" "$@"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
永久代只是构成堆的众多空间之一。您可以增加整个堆,直到分配的部分足够大以满足您的需要,或者您可以简单地增加对 PermGen 空间的分配。为了做到后者,请使用
For sbt 0.12.0
最好将其放入您的 .bash_profile 中(假设您使用的是 bash)
对于 sbt 0.7
在您的情况下,将 -XX:MaxPermSize 增加到大于256米。请记住,需要超过 256m 表明可能存在其他问题。
The PermGen is just one of many spaces that as a whole make up the Heap. You could increase the entire heap until the portion that is allocated is big enough for your needs or you could simply increase the allocation toward the PermGen space. In order to do that latter, use
For sbt 0.12.0
It would be best to put this in your .bash_profile (assuming you are using bash)
For sbt 0.7
In your case increase the -XX:MaxPermSize to something more than 256m. Keeping in mind that needing more than 256m suggests that there may be other issues.
你需要允许java分配更多的内存。
您也可以重新访问一些其他内存设置。我正在运行 SBT 0.11.2,除了指定的 Xmx 之外什么都没有。
顺便说一句,如果您在编译过程中确实遇到任何 GC 问题,我会感到惊讶。更改 GC 收集策略与运行时间较长的进程更相关。
You need to allow java to allocate more memory.
You might revisit some of those other memory settings as well. I'm running SBT 0.11.2, and I have nothing but Xmx specified.
As an aside, I'd be surprised if you actually have any GC issues during a compile. Changing the GC collection strategy more relevant for longer running processes.