IntelliJ IDE uses more memory than maximum heap size (Xmx)


Why does the IDE consume more memory than specified in heap size defined as Xmx value in the .vmoptions file?


This is expected behaviour for any Java-based application. 

It is not possible to predict how much memory the IDE would realistically allocate with reasonable precision. It can be roughly calculated using this formula:


Xmx size + ReservedCodeCacheSize + Metaspace (dynamic) + 8 * 2 (Xss size (2M by default) * threads) + off-heap allocations via ByteBuffers + JNI code



Metaspace is the runtime representation of Java classes within a JVM process - basically, any information the JVM needs to work with a Java class. 

ReservedCodeCacheSize is the amount of memory allocated for the JIT compiler code cache.

threads - 30, typically.

ByteBuffer allows allocating memory outside of the Java heap, which can reduce the load on the garbage collector. The IDE uses ByteBuffers as an intermediate cache when accessing its indices, among other things.

JNI is a Java Native Interface: code natively compiled for a specific architecture, shared libs within .so/.dll/.dylib files (depending on the operating system you’re running).

You can find more detailed information on the topic here:

6 out of 16 found this helpful
1 comment

After i change heap size to 8000 and click Save and Restart when i go to this menu again it shows current value: 1024 is 8000 not being applied?


Please sign in to leave a comment.

Have more questions?

Submit a request