Error during VM initialization, could not reserve enough space for a bunch of objects - Spring Tool Suite?

I get the following error when creating a Gradle project, but SpringToolSuite works fine

Error occured during the initialization of VM Could not reserve enough space for object heap Error: Could not create Java Virtual Machine Error: A fatal exception has occurred. Program will exit. 

I have 4 GB of RAM, my OS is 64-bit, and I recently updated Java from 1.6 to 1.7

And this is my sts.ini

  -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813 -product org.springsource.sts.ide --launcher.defaultAction openFile --launcher.XXMaxPermSize 1024M -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms512m -Xmx768m -XX:MaxPermSize=1024m 

I tried all kinds of options -Xms and -Xmx and still the same error.

+4
source share
4 answers

If your STS is working fine, the problem is starting the JVM gradle to create your project.

If you use gradle Wrapper, you can configure its own file if you want eclipse to override its parameters, than you can try to edit gradle settings in the section "Window"> "Settings"> gradle> "Arguments with your custom values ​​for -Xmx -Xms and -Xms .

enter image description here

+3
source

You need to go to your main gradle folder where you install gradle, so if you installed gradle in the ex home directory:

 C:\Users\YourUserName\.gradle\deamon\2.1 

and create a file there

 gradle.properties 

Paste into file:

 org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.java.home=C:/Development/Tools/Java/Java7/bin [CHANGE IT TO YOUR PATH TO JAVA_HOME] 
+1
source

I had the same problem. The problem was solved for me:

Eclipse -> run -> run configuration -> arguments

and add

-XX: MaxHeapSize = 1024 m

The size depends on your application. Hope this helps you. If you use STS, I think you can find the same option as Eclipse.

0
source

In android studio, I added this line:

 org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 
0
source

Source: https://habr.com/ru/post/1488094/


All Articles