MPLAB® X IDE provides a default configuration for the Java Virtual Machine (JVM) that should be optimal for the vast majority of users. This information is provided for those rare circumstances where specialized settings are required.
MPLAB X IDE Version 2.15 and Later
Windows®: | C:\Program Files\Microchip\MPLABX\mplab_ide\etc\mplab_ide.conf |
Windows (64-bit): | C:\Program Files (x86)\Microchip\MPLABX\mplab_ide\etc\mplab_ide.conf |
Linux®: | /opt/microchip/mplab_ide/etc/mplab_ide.conf |
macOS®: | /Applications/microchip/mplabx/mplab_ide.app/Contents/Resources/mplab_ide/etc/mplab_ide.conf |
Windows (64-bit)/Linux
In the default_options parameter of mplab_ide.conf, the Xmx option specifying the max heap space (the max amount of memory MPLAB X IDE can use) is not included. This is because the Java Run-Time Environment (JRE) itself will look at the environment where it is being run and will select an appropriate value. This value is typically 1/4 of the max amount of memory in the system. If you want to allocate a larger value for the max heap size for MPLAB X IDE, you can add -J-XmxVALUE. For example, -J-Xmx4096m will set the upper limit to 4 GB. This will help improve performance when working on large Harmony projects or if you have many projects open.
Windows (32-bit)
On Windows (32-bit), the highest you can set the IDE JVM usage memory to is 600 MB. If you experience sluggish behavior with MPLAB X IDE and choose to modify -J-Xmx, keep it around 512 MB for the best results. Unfortunately, the 32-bit version of the JRE cannot handle higher values than this. Setting the -J-Xmx value too high can cause the IDE to fail to launch. Setting -J-Xmx512m is fairly safe, but 600 MB and above starts to cause problems. Unfortunately, it can be difficult to find a contiguous block of available memory that large on 32-bit systems. On MPLAB versions 2.25 and above, we have included -J-Xmx512m in mplab_ide.conf by default for all 32-bit systems.
macOS
You may change the upper value of Xmx to increase the max amount of memory used by MPLAB X IDE. In some older versions of the JRE6, we saw some issues when allocating more memory than the current default of -J-Xmx512m (512 MB). However, this has been fixed in the newest releases of JRE6. So, you can add -J-XmxVALUE. For example, -J-Xmx4096m will set the upper limit to 4 GB.
MPLAB X IDE Version 2.10 and Earlier
Windows: | C:\Program Files\Microchip\MPLABX\mplab_ide\etc\mplab_ide.conf |
Windows (64-bit): | C:\Program Files (x86)\Microchip\MPLABX\mplab_ide\etc\mplab_ide.conf |
Linux: | /opt/microchip/mplab_ide/etc/mplab_ide.conf |
macOS: | /Applications/microchip/mplabx/mplab_ide.app/Contents/Resources/mplab_ide/etc/mplab_ide.conf |
Modifying the default_options Parameter
Edit the default_options parameter in mplab_ide.conf:
default_options="--branding mplab -J-Xms384m -J-Xmx512m -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled"
You can experiment with increasing the Xms and Xmx parameters depending upon how much memory you have installed in your system and how many other applications you are running concurrently (e.g., -J-Xms256m and -J-Xmx384m or -J-Xms384m and -J-Xmx512m). There is a maximum limit depending upon the version of the JVM you have installed.
-J-Xmsn: Initial size (in bytes) of the memory allocation pool. This value must be a multiple of 1024 greater than 1 MB. The letter k, K, m, or M may be appended to indicate kilobytes or megabytes.
-J-Xmxn: Maximum size (in bytes) of the memory allocation pool. This value must a multiple of 1024 greater than 2 MB. The letter k, K, m, or M may be appended to indicate kilobytes or megabytes.
-J-XX:+UseConcMarkSweepGC: Forces the JVM to use a different algorithm for garbage collection that is less likely to cause intrusive pauses.
-J-XX:+CMSClassUnloadingEnabled: Enables class unloading when using the -J-XX:+UseConcMarkSweepGC option which doesn't enable it by default.
Reference: Tuning JVM switches for performance