I have multiple Java applications running on the same server and I need to split up the memory between them.
I'm using native memory tracking as described here to determine the total memory usage of the applications.
However this doesn't seem to be correct. For example, I have a java process using 10.6G (RES) of memory according to htop but only 5.7G are reserved according to the JVM's native memory summary.
How can I find out what the additional memory is used for?
Running jcmd <pid> VM.native_memory summary
:
Total: reserved=5716455KB, committed=4879603K
- Java Heap (reserved=4194304KB, committed=4067328KB)
(mmap: reserved=4194304KB, committed=4067328KB)
- Class (reserved=681408KB, committed=199308KB)
(classes #25131)
( instance classes #23456, array classes #1675)
(malloc=7616KB #109431)
(mmap: reserved=673792KB, committed=191692KB)
( Metadata: )
( reserved=169984KB, committed=168448KB)
( used=149883KB)
( free=18565KB)
( waste=0KB =0.00%)
( Class space:)
( reserved=503808KB, committed=23244KB)
( used=16725KB)
( free=6519KB)
( waste=0KB =0.00%)
- Thread (reserved=277119KB, committed=133071KB)
(thread #135)
(stack: reserved=276480KB, committed=132432KB)
(malloc=483KB #812)
(arena=156KB #268)
- Code (reserved=268854KB, committed=189838KB)
(malloc=13518KB #40693)
(mmap: reserved=247688KB, committed=168672KB)
(arena=7648KB #4200)
- GC (reserved=241171KB, committed=236459KB)
(malloc=51951KB #156827)
(mmap: reserved=189220KB, committed=184508KB)
- Compiler (reserved=799KB, committed=799KB)
(malloc=666KB #3312)
(arena=133KB #5)
- Internal (reserved=4793KB, committed=4793KB)
(malloc=4761KB #8973)
(mmap: reserved=32KB, committed=32KB)
- Other (reserved=2604KB, committed=2604KB)
(malloc=2604KB #288)
- Symbol (reserved=30655KB, committed=30655KB)
(malloc=26140KB #408202)
(arena=4515KB #1)
- Native Memory Tracking (reserved=11666KB, committed=11666KB)
(malloc=40KB #521)
(tracking overhead=11627KB)
- Arena Chunk (reserved=1740KB, committed=1740KB)
(malloc=1740KB)
- Logging (reserved=4KB, committed=4KB)
(malloc=4KB #186)
- Arguments (reserved=19KB, committed=19KB)
(malloc=19KB #512)
- Module (reserved=615KB, committed=615KB)
(malloc=615KB #3714)
- Synchronizer (reserved=696KB, committed=696KB)
(malloc=696KB #5838)
- Safepoint (reserved=8KB, committed=8KB)
(mmap: reserved=8KB, committed=8KB)
The application is a Tomcat 9.0.45 (with an application) running on AWS Linux with Java 11.0.11+8.