anon-rss和total-vm是什么意思 [英] what does anon-rss and total-vm mean
问题描述
最近,我的Linux机器上的tomcat进程突然被杀死.经过调查,我在/var/log/messages文件中发现以下错误消息:
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
现在,有人可以告诉我total-vm
中包含的所有内容吗?anon-rss
与rss
有何不同?
Now, can someone please tell me that what all is included in total-vm
and how is anon-rss
different from rss
?
推荐答案
据我了解,进程使用的虚拟内存的大小列为"total-vm".它的一部分实际上已映射到RAM本身(已分配和使用).这是"RSS".
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".
部分RSS分配在实际的内存块中(而不是映射到文件或设备中).这是匿名内存("anon-rss"),并且还有RSS内存块被映射到设备和文件("file-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").
因此,如果您在vim中打开一个大文件,则文件rss会很高,另一方面,如果malloc()大量内存并真正使用它,那么您的anon-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.
另一方面,如果您分配了大量空间(使用malloc()),但从未使用过,则total-vm会更高,但不会使用实际内存(由于内存过量使用),所以rss值会很低.
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.
这篇关于anon-rss和total-vm是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!