"Private_Dirty"是什么意思?内存在SMAP中意味着什么? [英] What does "Private_Dirty" memory mean in smaps?

查看:1828
本文介绍了"Private_Dirty"是什么意思?内存在SMAP中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个消耗RAM的Java程序,并且正在设法弄清他对所有这些内存的处理方式.因此,我正在此PID上执行pmap -x,这是结果的一部分:

I have a huge RAM-consuming Java process and I'm trying to figure what he's doing with all this memory. So, I'm doing a pmap -x on this PID and here is a piece of the result :

Address           Kbytes     RSS   Dirty Mode   Mapping
0000000000001000       4       0       0 rw---    [ anon ]
0000000000400000      48       0       0 r-x--  java
000000000050b000       4       4       4 rw---  java
0000000003b9d000     264     224     212 rw---    [ anon ]
0000000003bdf000 2199556 1887992 1830160 rw---    [ anon ]
000000396c800000     112     108       0 r-x--  ld-2.5.so
000000396ca1c000       4       4       4 r----  ld-2.5.so
[...]
ffffffffff600000    8192       0       0 -----    [ anon ]
----------------  ------  ------  ------
total kB         7072968 4382820 4270104

正如您在地址3BDF000上看到的那样,有一个2199556 KBytes与1830160 Dirty的映射.

As you can see on address 3BDF000 there is a mapping of 2199556 KBytes with 1830160 of Dirty.

在/proc/10139/smaps中,可以看到更多详细信息:

In /proc/10139/smaps, on can see it with more details :

03bdf000-89fe0000 rw-p 03bdf000 00:00 0
Size:           2199556 kB
Rss:            1887996 kB
Shared_Clean:         0 kB
Shared_Dirty:         0 kB
Private_Clean:    57832 kB
Private_Dirty:  1830164 kB
Swap:            231996 kB
Pss:            1887996 kB

因此,我想知道这个脏内存是什么?我猜这些页面不必写到磁盘上,为什么将它们称为脏页面?

Hence, I'd like to know what this dirty memory is? I guess these pages don't have to be written to disk, so why are they called dirty?

推荐答案

内存是私有的,这意味着它是该进程专有的,或者是共享的,这意味着可能已映射并使用了多个进程(请考虑共享库的代码,等等) ).内存也可以是干净的-自从从磁盘加载或以零填充页面或其他任何形式提供以来,就没有进行过修改,因此,如果需要释放它以为其他进程提供内存页面,则可以将其丢弃,并在需要时重新加载/重新填充-或变脏,这意味着如果需要释放它,必须将其写到交换区,以便在必要时可以恢复修改后的内容.

Memory is either private, meaning it is exclusive to this process, or shared, meaning multiple processes may have it mapped and in use (think shared library code, etc.). Memory can also be clean - it hasn't been modified since it was loaded from disk or provided as zero-filled pages or whatever, and so if it needs to be freed to provide memory pages for other processes, it can just be discarded, and reloaded/re-filled if it is ever needed again - or dirty, which means if it needs to be freed up, it must be written out to a swap area so that the modified contents can be recovered when necessary.

在进程中看到大量私有脏数据并不一定非同寻常.问题在于,系统中所有进程之间的所有私有脏数据的总和占整体物理内存的很大一部分(确切的数量很大程度上取决于您的工作负载和可接受的性能),并且必须开始交换/交换东西. ..

It's not necessarily unusual to see large amounts of private dirty data in a process. The problem is when the sum of all private dirty data across all processes in the system becomes a significant portion (exact numbers depend greatly on your workload and acceptable performance) of your overall physical memory, and stuff has to start being swapped in/out...

这篇关于"Private_Dirty"是什么意思?内存在SMAP中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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