SBT keeps running out of memory on some of my bigger acceptance style tests using specs2 and spray-testkit. I have 10 gigs or RAM available and currently I start SBT (using the SBT extras script) with MaxPermSize at 512m, Xms at 1024m and Xmx at 2g.
The acceptance test runs through a client's entire business process in specific sequence, so it's not easy to split the acceptance test in to multiple smaller tests.
Any ideas how I can configure my environment better, or gotcha's that I should look out for will be appreciated.
For what it's worth, I'm using Oracle Java under Ubuntu, and the project uses Scala 2.10, sbt 0.12.2, spray 1.1-M7 with specs2 1.14.
When running the system outside of test, or when using smaller tests, everything runs like clockwork. It's only during larger tests that things go nutty.
One thing you can do is to fork your tests, you can set your memory settings in the build.sbt directly:
fork in Test := true
javaOptions in Test += "-Xmx2048m" // we need lots of heap space
This means that the tests don't depend on you running with the SBT extras script, and the settings don't affect sbt itself. You can also set various other options (see Forking), including changing the working directory, and even the JRE to use.
I suspect you're hitting the exponential problem with the specs2 immutable style. The solution is simply to add more memory or bust your tests up into smaller chunks. More info is here:
http://www.artima.com/articles/compile_time.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With