Recently, tomcat process on my Linux machine was killed abruptly. Following my investigation, I discovered the following error message in the /var/log/messages file:
kernel: [1799319.246494] Out of memory: Kill process 28536 (java) score 673 or sacrifice childSep kernel: [1799319.246506] Killed process 28536 (java) total-vm:1271568kB, anon-rss:426528kB, file-rss:0kB
Now, could someone please tell me what all total-vm includes and how anon-rss differs from rss?
Asked by UW20989
As I understand, the size of the virtual memory that a process uses is listed as “total-vm”. Part of it is really mapped into the RAM itself (allocated and used). This is “RSS”.
Part of the RSS is allocated in real memory blocks (other than mapped into a file or device). This is anonymous memory (“anon-rss”) and there is also RSS memory blocks that are mapped into devices and files (“file-rss”).
So, if you open a large file in vim, the file-rss will be high; yet, if you malloc() a lot of memory and utilize it extensively, the anon-rss will also be high.
On the other hand, if you allocate a lot of space (with malloc()) but never use it, the total-vm will be higher, but no real memory will be used (due to the memory overcommit), resulting in low rss values.
Answered by Breno Leitão
Post is based on https://stackoverflow.com/questions/18845857/what-does-anon-rss-and-total-vm-mean