Coder Perfect

What are the meanings of anon-rss and total-vm?

Problem

On my Linux machine, the tomcat process was recently destroyed. 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, can someone please tell me that what all is included in total-vm and how is anon-rss different from rss?

Asked by UW20989

Solution #1

The size of the virtual memory that a process utilizes is reported as “total-vm,” as far as I can tell. A portion of it is really mapped into the RAM (allocated and used). “RSS” stands for “Really Simple Syndication.”

A portion of the RSS is stored in physical memory blocks (other than mapped into a file or device). This is anonymous memory (“anon-rss”), as well as RSS memory blocks tied to 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 (using malloc()) but never use it, the total-vm will be greater, 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