2

How can I allocate more PermGen space to Scala through my Build.scala file? I need this because our application has a large number of tests (written in Specs2) and a much larger number of generated classes, which is causing the following error to be thrown:

[error] ! spec spec spec spec
[error]     ThrowableException: PermGen space (TraversableLike.scala:244)
[error] sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
  • 1
    The JVM option for this is `-XX:MaxPermSize=`. If I am not mistaken you have to add it to the JVM that starts sbt, you can't set it in `Build.scala`. – Malte Schwerhoff Jun 11 '13 at 12:42
  • 1
    You should add `-XX:MaxPermSize=size` into your sbt script. Take a look on http://stackoverflow.com/questions/8331135/transient-outofmemoryerror-when-compiling-scala-classes – Vladimir Petrosyan Jun 11 '13 at 12:48
  • While heap space is not a permgen space, steps to do should be the same (except jvm option value and name -- use the one that was provided in of Malte and Vladimir). – om-nom-nom Jun 11 '13 at 12:51
  • You cannot do what you want because the JVM has already been launched by the time SBT code reads any of the project definition files, whether `.sbt` or `.scala`. – Randall Schulz Jun 11 '13 at 14:54
  • Refining Vladimir's comment, the answer at http://stackoverflow.com/a/14561346/491216 even mentions PermGen space. – Malte Schwerhoff Jun 12 '13 at 07:15

0 Answers0