Documentation exists in various locations; thus this post is intended to capture the notes I found useful from various sites. Where applicable I intend to link to the location I found the information (in case some further piece of information is of value to you).
=================================================
Setting the java heap size is fairly simple - it can be done in a number places.
The first (and potentially most obvious) is via command line; simply type them out.
example: java -Xmx128mI am not terribly familiar with the command line interface for Eclipse, so I won't be documenting particulars; below, however, are some guidelines about how to set the parameters and what to watch out for when asserting them.
The second, and more obvious to me, is through the use of the initialization file, entitled "eclipse.ini". It is located in the directory in which you installed eclipse ... the one that has the "dropins" folder. Opening it up reveals several settings - the one you will be interested in is under "-vmargs".
The third is through the Eclipse interface proper.
I snagged the steps from here.
1. From the Eclipse main menu, choose "Window" then "Preferences".
2. On the Preferences dialog
Expand "Java" in the left-hand column
Under Java, click "Installed JREs"
You will now see your installed JREs with the one currently used being ticked
Select the "default" JRE and click the "Edit" button to the right of it.
3. Part way down the "Edit JRE" dialog, you'll see a field labeled "Default VM Arguments".
Go to this and put in your -X memory arguments.
I used "-Xms128M -Xmx512M".
Regardless of your preferred method, the two attributes are "-Xms80m" and "-Xmx256".
Xms refers to the start heap size, Xmx to the max heap size.
You need enough initial heap size to start building and you need enough maximum heap size to allow Eclipse/java to finish whatever tasks you've intended it to complete.
Several potential errors (link) in setting them include
- missing units or inappropriate units
- extra spaces, incorrect syntax, or non-whole units when assigning the amount of memory
- assigning unreasonable memory sizes
examples of missing a unit: "-Xms42" or "-Xmx100"Extra spaces, incorrect syntax, or non-whole units when assigning the amount of memory
valid options for units are "m" or "g"; "mb" and "gb" are wrong
units are case insensitive; thus "m", "M", "g", and "G" are all valid units
parsing of the command requires no spacing or operator (like an equals sign)
correct ... "-Xms75m"in addition, separation of separate commands (like setting Xms and Xmx) is simple
incorrect ..."-Xms 75m"; "-Xms=75m"; "-Xms:75m"
if using the .ini, place each on a separate lineEnsure the amount of memory that you set aside is a whole number
if setting the Xms and Xmx within Eclipse, put on the same line, one space apart
correct ... -Xms101m
incorrect ... -Xms1.3m
Assigning unreasonable memory requests
Note: The default heap range is from 0 to 64 mb.
Setting the Xms in excess of 64 mb will likely net you:
Incompatible initial and maximum heap sizes specifiedSetting either Xms or Xmx in excess of your computer's available RAM will show
Could not reserve enough space for object heap
As you can see, setting the initial and maximum heap sizes is simple. This is also implicit as most of this post was about how to properly format the values to which you set requested memory. If you find anything wrong with these directions or think a particular aspect of clarity should be included, please comment.Could not create the Java virtual machineSetting either Xms or Xmx in excess of current anticipated use-Xmx1g is reasonable (though high)-Xmx512g is not reasonable
Thanks.