How to prevent java.lang.OutOfMemoryError: PermGen space at Scala compilation?

前端 未结 8 1754
感动是毒
感动是毒 2020-12-02 07:36

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]          


        
8条回答
  •  情歌与酒
    2020-12-02 07:58

    It looks like a memory leak in SBT for me as in my case the program compiles and runs successfully for about 3-5 times before hitting the exception which is fixed by SBT restart.

    The most adequate solution indeed seems to be -XX:MaxPermSize= JVM parameter as Alexey Romanov suggests or to restart SBT periodically if it helps.

    But there is another interesting way: try switching to Java 8. AFAIK it doesn't use PermGen any more and is probably immune to this exception this way.

    I still hope SBT authors will address this issue in future versions.

提交回复
热议问题