True HeapDumpOnOutOfMemoryError

When I run my unit tests in Maven on windows, I get an OutOfMemory exception. I tried adding the -XX: -HeapDumpOnOutOfMemoryError parameter to the valid argLine argument, but no dump file is created. I also tried to add the same to MAVEN_OPTS, but still nothing, I just get an OutOfMemory exception and the process freezes until I manually crash it.

My pom looks like this:

<plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <testFailureIgnore>false</testFailureIgnore> <argLine>-Xms512m -Xmx512m -XX:PermSize=256m -XX:-HeapDumpOnOutOfMemoryError</argLine> <forkMode>once</forkMode> </configuration> </plugin> 

MAVEN_OPTS:

 set MAVEN_OPTS=-XX:-HeapDumpOnOutOfMemoryError 

Do you have an idea why a dump file is not created?

+6
maven out-of-memory surefire
source share
3 answers

Try the following:

 set MAVEN_OPTS="-Dmaven.surefire.debug=\"-XX:-HeapDumpOnOutOfMemoryError\"" 
+2
source share

Perhaps a memory leak has been fixed, see http://jira.codehaus.org/browse/SUREFIRE-495 . You might want to try surefire 2.7.1 or later.

+1
source share

I think you forgot the way:

  <argLine>-Xms512m -Xmx512m -XX:PermSize=256m -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp</argLine> 

with this argument:

  -XX:HeapDumpPath=/tmp 
0
source share

All Articles