Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does anon-rss and total-vm mean

Recently, tomcat process on my Linux machine was killed abruptly. After investigation I found below error message in /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?

like image 867
UW20989 Avatar asked Sep 17 '13 09:09

UW20989


People also ask

What is anon 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").

What is RSS memory in Linux?

In computing, resident set size (RSS) is the portion of memory occupied by a process that is held in main memory (RAM). The rest of the occupied memory exists in the swap space or file system, either because some parts of the occupied memory were paged out, or because some parts of the executable were never loaded.

What is invoked OOM killer?

What is OOM Killer. OOM Killer is special process invoked by kernel when system is critically low on memory. This occurs when processes consume large amount of memory and system requires more memory for its own processes. When process starts, it requests block of memory from kernel.

What triggers OOM killer?

The solution that the linux kernel employs is to invoke the OOM Killer to review all running processes and kill one or more of them in order to free up system memory and keep the system running. The OOM Killer will only get invoked when the system is critically low on memory.


1 Answers

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 huge file in vim, the file-rss would be high, on the other side, if you malloc() a lot of memory and really use it, your anon-rss would be high also.

On the other side, if you allocate a lot of space (with malloc()), but nevers use it, the total-vm would be higher, but no real memory would be used (due to the memory overcommit), so, the rss values would be low.

like image 104
Breno Leitão Avatar answered Oct 11 '22 22:10

Breno Leitão