When configuring IntelliJ IDEA’s VM options, we recommend that you consider the available memory on your computer, in this case 8GB of RAM.
With this in mind, you need to configure your Java Virtual Machine (JVM) settings so that IntelliJ IDEA runs properly within the available resources.

Here are some suggestions for setting VM options in IntelliJ IDEA with an 8GB RAM machine and an Intel i3 processor:

  1. Heap Memory (Xmx and Xms):

    • Set the maximum heap size (-Xmx) to a value that is suitable for your system. With 8GB of RAM, you could allocate a significant portion, but not all, of the memory to IntelliJ. For example, you might use -Xmx4g to allocate 4GB of memory. Adjust this value based on your preferences and the other applications you might be running.
    • Set the initial heap size (-Xms) to a reasonable value, perhaps half of the maximum heap size. For example, -Xms2g for 2GB.

    Example:

-Xms2g -Xmx4g
  1. Permsize and Metaspace:

    • If you are using a Java version before Java 8, consider specifying PermGen size. However, for Java 8 and later, this is replaced by Metaspace. Adjust the Metaspace size based on your needs.

    Example:

-XX:MaxMetaspaceSize=512m
  1. Garbage Collection:

    • You can use JVM options to configure garbage collection algorithms based on your application’s characteristics. However, for day-to-day development, the default settings are usually sufficient.
  2. Additional Configuration:

    • Depending on your specific requirements and the plugins you use, you might need additional configurations. For example, if you work with Android projects, you might need to allocate additional memory for Gradle builds.

    Example:

-XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC

To set these options in IntelliJ IDEA:

  1. Open IntelliJ IDEA.
  2. Navigate to “Help” > “Edit Custom VM Options…”
  3. Add or modify the VM options according to your preferences.

Keep in mind to screen your system’s execution whereas utilizing IntelliJ Idea, particularly in the event that you run other memory-intensive applications at the same time. Alter the JVM alternatives based on your real needs and accessible assets.

Here my optimal setup for low-end device:

-Xms128m
-Xmx1024m
-XX:ReservedCodeCacheSize=100m
-XX:+IgnoreUnrecognizedVMOptions
-XX:MaxPermSize=512m
-XX:+UseConcMarkSweepGC
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
--add-opens=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED
--add-opens=java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED
-javaagent:D:\ja-netfilter-all\ja-netfilter.jar=jetbrains
  • -Xmx: Sets the maximum heap size, specifying the maximum amount of memory that the Java Virtual Machine (JVM) can use for the heap. For example, -Xmx2000m sets the maximum heap size to 2000 megabytes.

  • -Xms: Sets the initial heap size, defining the amount of memory reserved for the heap when the JVM starts. For example, -Xms300m sets the initial heap size to 300 megabytes.

  • -XX:MaxMetaspaceSize: Sets the maximum size of the Metaspace, which is the memory area used for class metadata in Java 8 and later versions. For example, -XX:MaxMetaspaceSize=256m sets the maximum Metaspace size to 256 megabytes.