JVM memory parameters for specifications 2

SBT continues to exhaust the memory of some of my larger tricks-style tests using specs2 and spray-testkit . I have 10 gigabytes or RAM, and I am currently running SBT (using the optional SBT script features ) with MaxPermSize on 512 m, Xms on 1024 m and Xmx on 2g.

The acceptance test passes through the entire business process of the client in a certain sequence, so it is not easy to divide the acceptance test into several smaller tests.

Any ideas on how I can set up my environment better, or get what I need to pay attention to, will be appreciated.

Why do I use Oracle Java under Ubuntu, and the project uses Scala 2.10, sbt 0.12.2, spray 1.1-M7 with specs2 1.14.

When you start the system outside the test or when using small tests, everything works like a clock. It is only during larger tests that things go nuts.

+6
source share
2 answers

I suspect you are facing an exponential problem with the indispensable style specs2. The solution is to simply add more memory or overload your tests into smaller pieces. More info here:

http://www.artima.com/articles/compile_time.html

+2
source

One thing you can do is to develop your tests, you can directly set your memory settings in the build.sbt file:

fork in Test := true javaOptions in Test += "-Xmx2048m" // we need lots of heap space 

This means that the tests do not depend on how you work with additional SBT script functions, and the settings do not affect sbt itself. You can also set various other parameters (see Forking ), including changing the working directory and even the JRE to use.

+6
source

All Articles