Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing memory settings in eclipse.ini causes Could not create JVM

Tags:

java

eclipse

jvm

I have a following problem. When I try to raise memory for JVM in eclipse.ini file, I always get Could not create Java Virtual Machine exception.

My current memory settings are

-Xms1024m
-Xmx1024m
-Xmn256m
-Xss2m

And I would like to raise them to

-Xms2048m 
-Xmx2048m
-Xmn512m
-Xss2m

I am running on 32-bit Java, JDK 1.6. I have a 64-bit machine with 12GB of memory. The reason I am not using a 64-bit Java is that we have encountered some problemes during develepment of our apps, so we switched back to 32-bit one.

Thanks a lot for advices.

EDIT

Ok, so here is my stack trace, it occurs when I try to run Eclipse. Also notice that I have Xms parameter set only to 512M but it works when it's set to 1024M, but it seems too much for one (even big) web app.

enter image description here

like image 639
Petr Mensik Avatar asked Apr 18 '12 07:04

Petr Mensik


People also ask

Why I am getting could not create Java Virtual Machine?

The most common cause for the “Could not create the Java Virtual Machine” error is that Java doesn't have enough available memory on your system to launch the VM client.


1 Answers

For one thing, you should never set your Xms to the same amount as Xmx because this will effectively cause the garbage collector to never run until your Java VM memory is completely used up. Set Xmx to the maximum memory you want to allocate to the Java applications and VM, and Xms to the maximum amount of memory the VM should use without bothering too much to garbage collect. You may find this will solve your problem.

like image 153
Renato Avatar answered Sep 25 '22 20:09

Renato