Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding memory parameters for Eclipse

Tags:

eclipse

jvm

I just installed Eclipse 4.2 (Juno) on Linux 64 bit. I have looked at several Eclipse.ini threads on Stack Overflow, but I still don't understand the relationship between the different memory parameters.

On one hand, there are parameters that are for the VM and that go under -vmargs (for example, -Xms and -Xmx, -XX), while others (for example, --launcher.XXMaxPermSize) are provided to Eclipse directly.

What is the relationship between these parameters? How would I set them up for a machine with more than 8 GB of memory?

I am aware of the long Stack Overflow question What are the best JVM settings for Eclipse?, but I would like to learn how to adjust these parameters myself.

For reference, after installation, the default parameters that Juno has are:

-startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.200.v20120522-1813 -product org.eclipse.epp.package.cpp.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -XX:MaxPermSize=256m -Xms40m -Xmx512m 
like image 224
Josh Avatar asked Oct 12 '12 18:10

Josh


People also ask

How do you pass memory arguments in Eclipse?

On the Eclipse menu, clicks Run -> Run Configurations.. , select the Java application we want to run, click on the Arguments tab, VM arguments section, and adjust a better Java initial maximum heap size.

How do I see RAM usage in Eclipse?

Goto Window > Preferences > General and enable Show heap status and click OK. In the status bar of eclipse (bottom of the screen) a new UI element will appear. We can see 3 things: The amount of used memory by the application (including garbage that has not been collected), in the example 111MB.

What is XMS and XMX in Eclipse ini?

The flag Xmx specifies the maximum memory allocation pool for a Java virtual machine (JVM), while Xms specifies the initial memory allocation pool. The Xms flag has no default value, and Xmx typically has a default value of 256 MB.


1 Answers

If you are running Eclipse on an Oracle/Sun JVM, I would disregard --launcher.XXMaxPermSize (I personally remove it) and concentrate on -XX:MaxPermSize, -Xms and -Xmx.

The reason for --launcher.XXMaxPermSize is that some non-Oracle/Sun JVMs would choke on -XX:MaxPermSize. The launcher is programmed to detect the JVM and conditionally supply -XX:MaxPermSize. This of course is defeated by the explicit -XX:MaxPermSize setting in the default eclipse.ini file. That looks like a bug.

I never mess with -Xms setting. I set -Xmx1024m and -XX:MaxPermSize=512m.

like image 170
Konstantin Komissarchik Avatar answered Oct 27 '22 10:10

Konstantin Komissarchik