gpt4 book ai didi

gradle - 为 'gradle test' 增加堆内存

转载 作者:行者123 更新时间:2023-12-04 00:58:01 31 4
gpt4 key购买 nike

我在 Spring Boot 应用程序上运行“gradle 测试”时遇到问题,因为我看到 GC 调用次数过多的迹象,并且我的测试可能由于积极的 GC 工作造成的延迟而失败。

我如何告诉 gradle 在测试阶段或一般情况下使用更多的 JVM 允许的堆内存?

最佳答案

您可以使用 maxHeapSize测试任务的配置。

例子:

test{
...
minHeapSize = "128m"
maxHeapSize = "512m"
}
// minHeapSize is for initial heap size.
// maxHeapSize is for maximum heap size.

// Increasing minHeapSize makes jvm start with a bigger heap at the start.
// Increasing maxHeapSize enables jvm to allocate more memory for its heap.

查看文档以获取更多信息 https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html

关于gradle - 为 'gradle test' 增加堆内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52733942/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com