系统相关
首页 > 系统相关> > Linux笔记-oom时anon rss和total vm的含义

Linux笔记-oom时anon rss和total vm的含义

作者:互联网

dmesg 命令: https://blog.51cto.com/yangzhiming/2343192
https://stackoverflow.com/questions/18845857/what-does-anon-rss-and-total-vm-mean

查看oom信息
dmesg命令:

友好的显示log时间信息: dmesg -T
清空dmesg: dmesg -c
查看OOM: dmesg -T | grep "Out of memory"

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.

据我了解,进程使用的虚拟内存大小被列为“total-vm”。 它的一部分实际上映射到 RAM 本身(分配和使用)。 这是“RSS”。
RSS 的一部分分配在实际内存块中(而不是映射到文件或设备中)。 这是匿名内存(“anon-rss”),还有映射到设备和文件的 RSS 内存块(“file-rss”)。
所以,如果你在 vim 中打开一个大文件,file-rss 会很高,另一方面,如果你 malloc() 大量内存并真正使用它,你的 anon-rss 也会很高。
另一方面,如果您分配了很多空间(使用 malloc()),但从不使用它,总虚拟机会更高,但不会使用实际内存(由于内存过度使用),所以, RSS 值会很低。

标签:dmesg,oom,vm,anon,file,memory,rss,RSS
来源: https://www.cnblogs.com/gnivor/p/15817662.html