发布时间 2019-01-28 修改时间 2019-01-28
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.