如何防止 java.lang.OutOfMemoryError: PermGen space at Scala 编译? [英] How to prevent java.lang.OutOfMemoryError: PermGen space at Scala compilation?

查看:19
本文介绍了如何防止 java.lang.OutOfMemoryError: PermGen space at Scala 编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我的 scala 编译器有一个奇怪的行为.编译类时偶尔会抛出 OutOfMemoryError.这是错误消息:

I have noticed a strange behavior of my scala compiler. It occasionally throws an OutOfMemoryError when compiling a class. Here's the error message:

[info] Compiling 1 Scala source to /Users/gruetter/Workspaces/scala/helloscala/target/scala-2.9.0/test-classes...
java.lang.OutOfMemoryError: PermGen space
Error during sbt execution: java.lang.OutOfMemoryError: PermGen space

它只会偶尔发生一次,并且通常不会在随后的编译运行中抛出错误.我使用 Scala 2.9.0 并通过 SBT 编译.

It only happens once in a while and the error is usually not thrown on the subsequent compile run. I use Scala 2.9.0 and compile via SBT.

有人知道导致此错误的原因可能是什么吗?提前感谢您的见解.

Does anybody have a clue as to what might be the cause for this error? Thanks in advance for your insights.

推荐答案

OutOfMemoryError: PermGen space的原因是没有足够的永久代空间 :) 如果你使用的是 Oracle JVM,你需要将 -XX:MaxPermSize=256M (或其他一些空间量)参数添加到您的 sbt 脚本中.对于其他 JVM,请查看他们的文档.

The cause for OutOfMemoryError: PermGen space is that it doesn't have enough permanent generation space :) If you are using Oracle JVM, you need to add the -XX:MaxPermSize=256M (or some other amount of space) argument to your sbt script. For other JVMs, look at their documentation.

这篇关于如何防止 java.lang.OutOfMemoryError: PermGen space at Scala 编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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