anon-rss 和 total-vm 是什么意思 [英] what does anon-rss and total-vm mean

查看:140
本文介绍了anon-rss 和 total-vm 是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我的 Linux 机器上的 tomcat 进程突然被杀死.经过调查,我在/var/log/messages 文件中发现以下错误消息:

<前>内核:[1799319.246494] 内存不足:杀死进程 28536 (java) 得分 673 或牺牲 childSep内核:[1799319.246506] 杀死进程 28536 (java) total-vm:1271568kB, anon-rss:426528kB, file-rss:0kB

现在,谁能告诉我 total-vm 中包含的所有内容,以及 anon-rssrss 的不同之处?

解决方案

据我所知,进程使用的虚拟内存大小被列为total-vm".它的一部分真正映射到 RAM 本身(已分配和使用).这是RSS".

部分 RSS 分配在实内存块中(而不是映射到文件或设备中).这是匿名内存(anon-rss"),还有映射到设备和文件中的 RSS 内存块(file-rss").

所以,如果你在 vim 中打开一个大文件,file-rss 会很高,另一方面,如果你 malloc() 大量内存并真正使用它,你的 anon-rss 也会很高.

另一方面,如果您分配了大量空间(使用 malloc()),但从不使用它,则 total-vm 会更高,但不会使用实际内存(由于内存过量使用),所以,RSS 值会很低.

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?

解决方案

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.

这篇关于anon-rss 和 total-vm 是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆