John Kelvie
John Kelvie

Reputation: 858

Out of memory in PlayFramework 2.0

How do I increase the memory available to the Play environment? I am running out of memory after a time while running tests.

In particular, I get this error:

java.lang.OutOfMemoryError: PermGen space

Upvotes: 14

Views: 10497

Answers (3)

mhei
mhei

Reputation: 395

I solved this problem by adding:

javaOptions ++= Seq("-Xmx2048M", "-Xms512M", "-XX:MaxPermSize=2048M")

in Build.scala to the settings.

Upvotes: 14

Adam Lane
Adam Lane

Reputation: 1924

By setting the environment variable "_JAVA_OPTIONS", you can pass in variables that play/sbt will use during normal use. I found that this helped me avoid PermGen space errors when running my dev and tests.

For example:

export _JAVA_OPTIONS="-Xms64m -Xmx1024m -Xss2m -XX:MaxPermSize=256m"

Upvotes: 13

John Kelvie
John Kelvie

Reputation: 858

The Java startup options for play are founder in the script:

$PLAY_HOME/framework/build

The PermGen space can be increased by modifying the line at the bottom of the file:

java ${DEBUG_PARAM} -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M ...

Set the MaxPermSize variable to an appropriate value.

Upvotes: 8

Related Questions