Surefire HeapDumpOnOutOfMemoryError

发布于 2024-10-10 11:25:43 字数 760 浏览 6 评论 0原文

当在 Windows 上的 Maven 中运行我的单元测试时,我收到 OutOfMemory 异常。我尝试将 -XX:-HeapDumpOnOutOfMemoryError 选项添加到 Surefire argLine,但没有生成转储文件。 我也尝试向 MAVEN_OPTS 添加相同的内容,但仍然没有任何结果,我只是收到 OutOfMemory 异常,并且进程挂起,直到我手动终止它。

我的pom如下:

<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

你知道为什么没有生成转储文件吗?

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 MAVEN_OPTS=-XX:-HeapDumpOnOutOfMemoryError

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

硬不硬你别怂 2024-10-17 11:25:45

您的内存泄漏可能刚刚得到修复,请参阅 http://jira.codehaus.org/browse/SUREFIRE- 495..您可能想尝试 Surefire 2.7.1 或更高版本。

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.

疧_╮線 2024-10-17 11:25:45

我认为你忘记了路径:

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

用这个论点:

     -XX:HeapDumpPath=/tmp

I think you forget the path :

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

with this argument :

     -XX:HeapDumpPath=/tmp
输什么也不输骨气 2024-10-17 11:25:44

您正在使用“-”来禁用该选项。使用“+”来启用它:

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

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

<argLine>... -XX:+HeapDumpOnOutOfMemoryError</argLine>
                 ^ 
娇纵 2024-10-17 11:25:44

试试这个:

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

Try this:

set MAVEN_OPTS="-Dmaven.surefire.debug=\"-XX:-HeapDumpOnOutOfMemoryError\""
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文