【发布时间】:2021-03-24 20:50:00
【问题描述】:
我有一个带有集成测试的 grails 4.0.2 应用程序,需要大量内存。
当前,当我运行测试时,它失败并显示:java.lang.OutOfMemoryError: GC 开销限制超出。在旧 grails 中,您可以在 build.config 中定义 grails.project.fork。
此外,我尝试使用所需的内存配置指定 GRAILS_OPTS 但这给了我消息 -> 忽略选项 MaxPermSize=512m; 8.0 中移除了支持
我也尝试过将 build.gradle 调整为以下
bootRun {
ignoreExitValue true
jvmArgs(
'-Dspring.output.ansi.enabled=always',
'-noverify',
'-XX:TieredStopAtLevel=1',
'-Xmx2048m')
sourceResources sourceSets.main
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}
tasks.withType(GroovyCompile) {
configure(groovyOptions) {
forkOptions.jvmArgs = ['-Xmx2048m']
}
}
为测试 grails 4 指定内存设置的正确方法是什么?
【问题讨论】: