Unit Testing: JVM memory settings

The default is behaviour of the Surefire Plugin is to launch a new JVM for running the tests.  See below an example on how to change the JVM memory settings:

<!-- Testing Plugin -->                
<plugin>                    
  <groupId>org.apache.maven.plugins</groupId>                    
  <artifactId>maven-surefire-plugin</artifactId>                    
  <version>....</version>
  <configuration>                        
      <argLine>-Xms256m -Xmx1024m -XX:MaxPermSize=512m</argLine>

It is also possible to re-use the existing JVM (<forkMode>never</forkMode>) or even to run a new JVM for each test (<forkMode>pertest</forkMode>)

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: