Scala编译时如何防止java.lang.OutOfMemoryError:PermGen空间?

编程入门 行业动态 更新时间:2024-10-22 14:42:20
本文介绍了Scala编译时如何防止java.lang.OutOfMemoryError:PermGen空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我注意到我的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.

更多推荐

Scala编译时如何防止java.lang.OutOfMemoryError:PermGen空间?

本文发布于:2023-11-25 18:52:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630928.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何防止   空间   java   Scala   PermGen

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!