Linux anon-rss 和 total-vm 是什么意思
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18845857/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
what does anon-rss and total-vm mean
提问by UW20989
Recently, tomcat process on my Linux machine was killed abruptly. After investigation I found below error message in /var/log/messages file:
最近,我的 Linux 机器上的 tomcat 进程突然被杀死了。经过调查,我在 /var/log/messages 文件中发现以下错误消息:
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
?
现在,有人可以告诉我所有都包含在其中total-vm
以及与它们有何anon-rss
不同rss
吗?
回答by Breno Leit?o
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".
据我了解,进程使用的虚拟内存的大小被列为“total-vm”。它的一部分真正映射到 RAM 本身(已分配和使用)。这是“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").
RSS 的一部分分配在实内存块中(而不是映射到文件或设备中)。这是匿名内存(“anon-rss”),还有映射到设备和文件中的 RSS 内存块(“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.
所以,如果你在 vim 中打开一个大文件,file-rss 会很高,另一方面,如果你 malloc() 大量内存并真正使用它,你的 anon-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.
另一方面,如果您分配了大量空间(使用 malloc()),但从不使用它,则总 vm 会更高,但不会使用实际内存(由于内存过量使用),因此, rss 值会很低。