This is my ps -eo snapshot some process occupy 2.1GB memory. Max size of its heap is 768mb and max size of its metaspace size is 256mb. And I guess the process will cannot occupy over 1024mb(768+256). But It isn`t. What is included in "RSS" except heap and metaspace? And how can I monitoring inside of "RSS" like heap stack analzer?
Asked
Active
Viewed 757 times
1
-
You should also take a look at this to know the meaning of -XX:MetaspaceSize: https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html#BABFAFAE -XX:MetaspaceSize=size Sets the size of the allocated class metadata space that will trigger a garbage collection the first time it is exceeded. This threshold for a garbage collection is increased or decreased depending on the amount of metadata used. The default size depends on the platform. – John the Traveler Mar 26 '20 at 01:27
1 Answers
1
the RSS is the size of all the memory used for any purpose including the JVM, Shared libraries, thread stacks, direct memory, memory mapped files, native memory use, native GFX components. The heap and meta space are just two memory regions.
Note the virtual memory size is 15 GB.
To see what the memory is used for you can dump /proc/{pid}/smaps
which shows all the memory regions (and there will be hundreds) and how much of each one is resident. (IntelliJ running on my machine has 403 memory regions)

Peter Lawrey
- 525,659
- 79
- 751
- 1,130