Summary: RSS is physical memory, vitrual memory it includes Swap from Disk so its bigger than RSS, Shared all Process using same memory so its also bigger than RSS Memory.
example:
total-vm:1968856kB, anon-rss:1137064kB, file-rss:0kB, shmem-rss:0kB,
4 gb ram or 3.8gb ram total physical
rs = 1137MB or 1GB
1968.856MB or 2GB
so oomkiller invoked to kill mysql because of out of memory.
vm vs rss vs shmem
- Resident Set Size (RSS)
- Virtual Memory Size (VSZ)
- Shared memory SHM
2.1. Resident Set Size
This is a measure of how much memory a process is consuming in our physical RAM, to load all of its pages after its execution.
RSS is not an accurate measure of the total memory processes are consuming, because it does not include memory consumed by libraries that were swapped out. On the other hand, the same shared libraries may be duplicated and counted in different processes. However, RSS is a reliable estimate.
Virtual Memory Size (VSZ)
This includes swapped memory ram +disk swap
portion | actually in memory | total (allocated) size |
|-------------+-------------------------+------------------------|
| binary | 400K | 500K |
| shared libs | 1000K | 2500K |
| stack+heap | 100K | 200K |
|-------------+-------------------------+------------------------|
| | RSS (Resident Set Size) | VSZ (Virtual Set Size) |
|-------------+-------------------------+------------------------|
| | 1500K | 3200K
Shred memory
A shared memory is an extra piece of memory that is attached to some address spaces for their owners to use. As a result, all of these processes share the same memory segment and have access to it.