开发者

surefire HeapDumpOnOutOfMemoryError

开发者 https://www.devze.com 2023-02-03 00:54 出处:网络
When running my unit tests in Maven on windows i\'m getting an OutOfMemory exception. I tried to add -XX:-HeapDumpOnOutOfMemoryError option to the surefire argLine, but no dump file is generated.

When running my unit tests in Maven on windows i'm getting an OutOfMemory exception. I tried to add -XX:-HeapDumpOnOutOfMemoryError option to the surefire argLine, but no dump file is generated. I also tried to add the same thing to MAVEN_OPTS, but still nothing, I simply get an OutOfMemory exception and the process hangs until I manually kill it.

My pom is as follows:

<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 MAVE开发者_运维技巧N_OPTS=-XX:-HeapDumpOnOutOfMemoryError

Do you have any idea why no dump file is generated?


You're using "-" to disable the option. Use "+" to enable it:

<argLine>... -XX:+HeapDumpOnOutOfMemoryError</argLine>
                 ^ 


Try this:

set MAVEN_OPTS="-Dmaven.surefire.debug=\"-XX:-HeapDumpOnOutOfMemoryError\""


Your memory leak might just be fixed, see http://jira.codehaus.org/browse/SUREFIRE-495. You may want to try surefire 2.7.1 or newer.


I think you forget the path :

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

with this argument :

     -XX:HeapDumpPath=/tmp
0

精彩评论

暂无评论...
验证码 换一张
取 消