Java 通过gradle构建项目时JVM空间耗尽

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53854198/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 00:55:16  来源:igfitidea点击:

JVM space exhausted when building a project through gradle

javagradlegradlew

提问by Rob Blinsinger

Receiving error message when building a project through gradle

通过 gradle 构建项目时收到错误消息

Expiring Daemon because JVM Tenured space is exhausted

由于 JVM Tenured 空间已用尽而使守护进程过期

回答by Rob Blinsinger

This means the JVM doesn't have enough memory to compile the Java files. There's a couple of steps that can be taken.

这意味着 JVM 没有足够的内存来编译 Java 文件。可以采取几个步骤。

  1. Run ./gradlew clean, which will remove everything including leftovers from previous builds which are no longer relevant.
  2. Run ./gradlew --stop, killing other gradle daemons which may be taking up memory.
  3. Allocate more memory. This can be done by adding the following to the gradle.propertiesfile.
  1. Run ./gradlew clean,这将删除所有内容,包括不再相关的先前构建中的剩余部分。
  2. 运行./gradlew --stop,杀死其他可能占用内存的 gradle 守护进程。
  3. 分配更多内存。这可以通过将以下内容添加到gradle.properties文件中来完成。

org.gradle.jvmargs=-Xms128m -Xmx1024m -XX:+CMSClassUnloadingEnabled

org.gradle.jvmargs=-Xms128m -Xmx1024m -XX:+CMSClassUnloadingEnabled