IntelliJ IDEA Gradle同步OutOfMemory

huangapple go评论74阅读模式
英文:

IntelliJ IDEA Gradle Sync OutOfMemory

问题

以下是翻译好的内容:

我想知道如何增加 IntelliJ IDEA 用于同步项目的 Gradle Daemon 进程的堆大小?

当前进程使用 -Xms256m -Xmx512m

我已经修改了 gradle-wrapper.properties 文件为:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
org.gradle.jvmargs=-Xms4g -Xmx4g -XX:MaxPermSize=2048m

我的 IntelliJ IDEA 设置:
IntelliJ IDEA Gradle同步OutOfMemory
IntelliJ IDEA Gradle同步OutOfMemory

英文:

I wonder how to increase heap size of Gradle Daemon process that IntelliJ IDEA uses to Sync project?

Current process uses -Xms256m -Xmx512m

I've already changed gradle-wrapper.properties file to:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
org.gradle.jvmargs=-Xms4g -Xmx4g -XX:MaxPermSize=2048m

My IntelliJ IDEA settings:
IntelliJ IDEA Gradle同步OutOfMemory
IntelliJ IDEA Gradle同步OutOfMemory

答案1

得分: 2

文件 gradle-wrapper.properties 仅用于包装器脚本org.gradle.jvmarg 选项不应出现在其中。

相反,应将其放入项目根目录下的 gradle.properties 文件中。有关更多信息,请参见此处

还要注意自 Java 8 起不再支持 XX:MaxPermSize

最后,您可能还需要增加 IntelliJ 本身使用的堆大小。通过右键单击状态栏并选择“内存指示器”来检查当前使用情况:

(图片已省略)

请注意右侧栏中当前和最大堆的情况。如果接近满了,您可以在“帮助” -> “更改内存设置”下更改堆大小:

(图片已省略)

您展示的内存设置适用于 IntelliJ 编译器。但从您展示的 Gradle 设置中可以看出,您将构建委托给了 Gradle。因此,这没有影响。

英文:

The file gradle-wrapper.properties is for the wrapper scripts only. The org.gradle.jvmarg option doesn't belong in there.

Rather, put it in a gradle.properties file in the project root directory. See here for more information.

Also be aware that XX:MaxPermSize is not supported since Java 8.

Lastly, you may need to also raise the heap used by IntelliJ itself. Check the current usage by right-clicking on the status bar and select Memory Indicator:

IntelliJ IDEA Gradle同步OutOfMemory

Notice the current and max heap in the bar to the right. If it is close to full, you can change the heap size under Help -> Change Memory Settings:

IntelliJ IDEA Gradle同步OutOfMemory

The memory settings you showed is for the IntelliJ compiler. But as you can see from the Gradle settings you also showed, you delegate the build to Gradle. So this has no effect.

答案2

得分: 0

你可以尝试这个链接来为IntelliJ分配更多的堆内存。

希望你的问题得到解决。

英文:

you can try this to give more heap memory to IntelliJ.

Hope you question is resolved.

huangapple
  • 本文由 发表于 2020年10月22日 18:10:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/64480049.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定