Increasing the memory available to Java

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Increasing the memory available to Java

1,100 Views
lpcware-support
Senior Contributor I

The LPCXpresso IDE is a Java application. While running the IDE, Java may report various errors that are related to the amount of memory available to the Java runtime. You may find these errors listed in the log file (<workspace>/.metadata/.log).  The errors are typically caused by having additional plugins installed into the IDE or by having a large number of projects and/or files in your workspace.

This FAQ shows how to increase the amount of Java memory available for each error type.

The INI file


When the IDE starts, it loads Java configuration information from the ini file. The locations and name of this file depends on the IDE being run:

  • LPCXPresso
    • <install>/lpcxpresso/lpcxpresso.ini

Java PermGen space (Out of Memory errors)


If you see java.lang.OutOfMemoryError: PermGen space errors, you need to increase the permanent generation (PermGen) space available to Eclipse.

To increase the PermGen size, edit the ini file, and add/edit the following line AFTER the -vmargs argument:

-XX:MaxPermSize=256M

Notes:

  1. If your IDE is already using these (or higher) settings, you can simply increase the sizes.

Java Heap Space (Heap errors)


If the LPCXpressoIDE starts reporting "Java Heap errors", or the IDE is frequently hourglassing, you will need to increase the Java Heap size.

To increase the Java heap size, edit the ini file, and add/edit the following lines (it is important that they are on separate lines}:

-vmargs
-Xms128m
-Xmx512m

Notes:

  1. If your IDE is already using these (or higher) settings, you can simply increase the sizes.
  2. The value for -Xmx must always be greater than or equal to the value for -Xms. Thus if you use -Xms512m, you must also set -Xmx512m.

After making these changes, you will need to close the IDE and restart.

You may also wish to enable the workspace preference such that the Java heap status is displayed in the IDE status bar (bottom right of Window). To do this, select:

Window -> Preferences -> General -> Show heap status

More information


Description of the arguments:

  • -Xms128m This defines the initial amount of heap space available to the Java runtime. This is dynamically allocated space and you should increase if you have a large number of files or projects in your workspace. The default is normally 128m; 256m would make it 256Mb.
  • -Xmx512m This defines the maximum amount of Heap space available to Java. This value must be greater than or equal to the value used in -Xms

A full discussion on the options available in the file can be found here: http://wiki.eclipse.org/Eclipse.ini

Labels (1)
Tags (3)
0 Kudos
0 Replies