Home > Uncategorized > How to resolve out of memory errors during maven test phase

How to resolve out of memory errors during maven test phase

Sometimes during maven test phase, jvm out of memory errors occur. It must know that maven tests, are executed in a forked jvm (this for default).
So if you launch maven with the usual parameters -Xmx512M -XX:MaxPermSize=512M etc. etc. these will not propagated to the forked test jvm.
The solution is to use this parameter: -Dmaven.surefire.debug.

So if you want increase the memory used during the test execution, you must use a command like this:
mvn -Dmaven.surefire.debug=”-server -Xmx512M -XX:MaxPermSize=512M” test
here I’ve used the “-server” parameter to force the jvm to use the parallel throughput gc, increasing the performance of the forked jvm about releasing memory.

The maven reference: http://maven.apache.org/plugins/maven-surefire-plugin/examples/debugging.html

Categories: Uncategorized Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment