Home > My Work > 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

Advertisements
Categories: My Work Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: