Getting Gradle error “Could not reserve enough space for object heap” constantly in Intellij IDEA

后端 未结 6 1199
太阳男子
太阳男子 2020-12-01 06:02

So I have a problem with memory allocation. Sometimes it works, and sometimes it doesn\'t. I\'ve read this thread and tried the advice there multiple times. Sometimes

6条回答
  •  不知归路
    2020-12-01 06:52

    Although this question is a bit older I would like to come up with the (possible) rootcause of the problem: the JVM requests a whole block of memory on startup. If it couldn't find it, the "Could not reserve..." error occurs. John Pape wrote an enlighting article in IBM's devblog about this issue: https://www.ibm.com/developerworks/community/blogs/aimsupport/entry/why_wont_my_jvm_start_with_this_heap_size?lang=en

    This is solving the problem for me:

    • variant a: using a 64 bit version of Java, so to give Java a bigger area of possible connected free memory
    • variant b: With 32 bit Java using smaller XMX amount. In the gradle.properties file I just use org.gradle.jvmargs=-Xmx150m and Gradle has no problems.

提交回复
热议问题