The JVM parameter Xmx and Xms are defining the Java heap space of the memory. The heap is the part of the memory where blocks of memory are allocated to objects and freed during garbage collection.
Beside the heap there is the non-heap memory. It is the memory the JVM allocated for purposes other than the heap, for example:
- Garbage Collection: In order for the garbage collector to know which objects are eligible for collection, it needs to keep track of the objects. So this is one part of the memory lost to this internal housekeeping.
- JIT compiler/optimization: The JVM optimizes the code during runtime. To know which parts to optimize it needs to keep track of the execution of certain code parts.
- JNI code: When using native code it will be loaded in the native memory.
- Metaspace/Permanent Generation: This is unlimited and also in the native part of the JVM.
It is not possible to fully control the non-heap memory of the JVM. If you experience an dramatical and/or constant increase of the memory it might be a memory leak. If that is the case, please raise a service request to investigate deeper.