I have difficulty creating a memory dump for my unit tests which produce out of memory errors.
My MAVEN_OPTS contains the following:
-Xmx1024m -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\Temp
However, when I run my unit tests from the command line using “mvn install”, I do not get any such memory dump when the OutOfMemoryError occurs.
How do I get the memory dump?
Thanks
Maven (
surefire-pluginto be precise) by default creates new JVM for running tests.MAVEN_OPTSvariable is used by the JVM running maven itself, but not forked test JVM. To change settings of that JVM, use the following code snippet: