Tag Archives: Could not reserve enough space for xxxxKB object heap error

IDEA reports an error Could not reserve enough space for xxxxKB object heap processing

When IDEA is developing an android project, it reports an error when it starts.

Error:Android Gradle Build Target: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation ‘C:\Users\musarona\.gradle\wrapper\dists\gradle-2.14.1-all\8bnwg5hd3w55iofp58khbp6yv\gradle-2.14.1’.

Error:Failed to complete Gradle execution.

Cause:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
———————–
Error occurred during initialization of VM
Could not reserve enough space for 1572864KB object heap

The main idea of ​​this error is that IDEA cannot allocate memory space to the virtual machine. To solve this kind of problem is to adjust the memory configuration in idea.exe.vmoptions.

-XX:ReservedCodeCacheSize=240m

Change to

-XX:ReservedCodeCacheSize=480m

If you still have problems, you can adjust other options in idea.exe.vmoptions

-Xmx512m

-XX:MaxHeapSize=512m

Ok. Edit, the next day the project is not working, so I will report this error.

Adjusting the heap in the compiler to 2G will not work.

Be puzzled. Think about it as an error reported in gradle, gradle should have a configuration that needs to take up memory. When I opened it, I was shocked. The default jvm memory of gradle is 1536m, which corresponds to 1572864KB in the error message. Then change it to a smaller size, change it to 512m, restart the compilation and pass it once.