执行 Lift 项目时使用 SBT 出现内存不足错误

发布于 2024-12-25 10:40:58 字数 722 浏览 4 评论 0原文

我正在使用 SBT 0.7.7。当我对 Lift 项目进行更改并通过以下方式重新编译时:

  1. jetty-stop
  2. compile
  3. 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:

  1. jetty-stop
  2. compile
  3. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝天白云 2025-01-01 10:40:58

永久代只是构成堆的众多空间之一。您可以增加整个堆,直到分配的部分足够大以满足您的需要,或者您可以简单地增加对 PermGen 空间的分配。为了做到后者,请使用

For sbt 0.12.0

导出SBT_OPTS=-XX:MaxPermSize=256m

最好将其放入您的 .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

export SBT_OPTS=-XX:MaxPermSize=256m

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.

多像笑话 2025-01-01 10:40:58

你需要允许java分配更多的内存。

# You may need more or less depending on your project.
export SBT_OPTS=-Xmx1024M

您也可以重新访问一些其他内存设置。我正在运行 SBT 0.11.2,除了指定的 Xmx 之外什么都没有。

顺便说一句,如果您在编译过程中确实遇到任何 GC 问题,我会感到惊讶。更改 GC 收集策略与运行时间较长的进程更相关。

You need to allow java to allocate more memory.

# You may need more or less depending on your project.
export SBT_OPTS=-Xmx1024M

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文