首页  

进程内存占用分析VSS/RSS/PSS/USS     所属分类 linux 浏览量 2855
linux进程内存占用有四种形式VSS/RSS/PSS/USS
Virtual/Resident/Proportional/Unique

Proportional 成比例的

VSS 单个进程全部可访问的地址空间,其大小可能包括还尚未在内存中驻留的部分。
RSS 单个进程实际占用的内存大小,包括该进程使用的共享库内存大小。一个共享库,可能被多个进程使用,实际该共享库只会被装入内存一次。
PSS相对于RSS计算共享库内存大小是按比例的。N个进程共享,该库对PSS大小的贡献只有1/N。
USS 单个进程私有的内存大小,即该进程独占的内存部分。如果进程终止,USS就是实际被返还给系统的内存大小。

VSS >= RSS >= PSS >= USS



Android has a tool called procrank (/system/xbin/procrank), 
which lists out the memory usage of Linux processes in order from highest to lowest usage. 
The sizes reported per process are VSS, RSS, PSS, and USS.


VSS (reported as VSZ from ps) is the total accessible address space of a process.
This size also includes memory that may not be resident in RAM like mallocs 
that have been allocated but not written to.

RSS is the total memory actually held in RAM for a process.
RSS can be misleading, because it reports the total all of the shared libraries 
that the process uses, even though a shared library is only loaded into memory once 
regardless of how many processes use it. 

PSS differs from RSS in that it reports the proportional size of its shared libraries, 
i.e. if three processes all use a shared library that has 30 pages, 
that library will only contribute 10 pages to the PSS that is reported for each of the three processes. 



USS is the total private memory for a process, 
i.e. that memory that is completely unique to that process.
USS is an extremely useful number because it indicates the true incremental cost of running a particular process. 
When a process is killed, the USS is the total memory that is actually returned to the system. 
USS is the best number to watch when initially suspicious of memory leaks in a process.

USS 适合用来监控进程的内存泄露情况

上一篇     下一篇
MySQL基础架构

java应用oom被kill排查记录

proc中进程内存信息

elasticsearch5.0搜索偏好

elasticsearch5.0的一般建议

elasticsearch5.0索引性能优化