作者:朱小小喵喵_972 | 来源:互联网 | 2022-12-02 16:45
我在Spring Boot应用程序上运行“渐变测试”时遇到问题,因为我看到GC调用的次数过多,并且由于积极的GC工作导致的延迟而导致测试失败。
我怎样才能告诉gradle在测试阶段或一般情况下使用JVM允许的更多堆内存?
1> miskender..:
您可以使用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