How to prevent java.lang.OutOfMemoryError: PermGen space? [duplicate]

This sometimes happens if you compile huge codebases – a lot of classes get loaded into the VM running sbt.

You need to increase the PermGen space for sbt – use the flag -XX:MaxPermSize=256m, where 256 you can change with the desired size of the permanent generation.

Run:

cat `which sbt`

to locate you sbt startup script. Then edit it to include the flag with the java command that runs the sbt launcher in the similar way as it is described here for modifying -Xmx and -Xms.

Adding the -XX:+CMSClassUnloadingEnabled flag should also enable sbt to unload the classloaders with classes from the previous compilation runs that are no longer being used.

EDIT:

Alternatively, you can set these options in the SBT_OPTS environment variable if you are using the extended script for running sbt.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)