最近的项目由于内存吃紧,急需对内存进行缩减,这里纪录查看进程内存耗用的相关知识。摘录自网络。

Terms

VSS - Virtual Set Size,占用的虚拟内存的大小(包括共享库所占用的内存)

RSS - Resident Set Size,实际上占用的物理内存的大小(包括共享库占用)

PSS - Proportional Set Size,实际上占用的物理内存的大小(比例分配共享库占用的内存)

USS - Unique Set Size,进程肚子占用的物理内存(不包括共享库占用的内存)

Overview

The aim of this post is to provide information that will assist in interpreting memory reports from various tools so the true memory usage for Linux processes and the system can be determined. 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. For the sake of simplicity in this description, memory will be expressed in terms of pages, rather than bytes. Linux systems like ours manage memory in 4096 byte pages at the lowest level. 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. VSS is of very little use for determing real memory usage of a process. 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. RSS is not an accurate representation of the memory usage for a single process. 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. PSS is a very useful number because when the PSS for all processes in the system are summed together, that is a good representation for the total memory usage in the system. When a process is killed, the shared libraries that contributed to its PSS will be proportionally distributed to the PSS totals for the remaining processes still using that library. In this way PSS can be slightly misleading, because when a process is killed, PSS does not accurately represent the memory returned to the overall system. 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 leaksin a process.

Overview

本片文章的目的是为了帮助理解从多种工具到处的关于Linux进程真实占用内存的报告。 Android有一个叫做procrank(/system/xbin/procrank)的工具,它可以从高到低的列出Linux进程的内存占用量。每个进程按大小可以分为VSS,RSS,PSS和USS。 为了简化描述,一下内存将以 “页”的形式来表示,而不是“字节”,像我们的Linux系统内存管理中最低级别的页有4096字节。

VSS,是一个进程总共可以访问的地址空间,其大小还包括了可能不在RAM中的内存(比如虽然malloc分配可空间,但尚未写入)。VSS很少被用于判断一个进程的真实内存使用量。

RSS是一个进程在RAM中真实存储的总内存。但是RSS还是可能会造成误导,因为它包括该进程所使用的所有共享库的大小,而不管共有多少个进程一起使用该共享库。所以RSS并不能准确反应但进程的内存占用情况。

PSS,与RSS不同,它按比例表示使用的共享库,例如:如果有三个进程都使用了同一个共享库,共占用了30页内存,那么PSS将认为每个进程分别占用该共享库10页的大小。PSS是非常有用的数据,因为系统中所有进程的PSS都相加的话,就刚好反映了系统中的全部内存占用。而当一个进程被销毁之后,其占用的共享库那部分比例的PSS,将会再次按比例分配给余下使用该库的进程。这样PSS可能会造成一点误导,因为当一个进程被销毁后,PSS不能准确的表示返回给全局系统的内存(the memory returned to the overall system)。

USS是一个进程所占用的私有内存,即该进程独占的内存。USS是非常有用的数据,因为它反映了运行一个特定进程真实的边际成本(增量成本)。当一个进程被销毁后,USS是真实返回给系统的内存。当进程中存在一个可以的内存泄漏时,USS时最佳观察数据。

查看PSS的内存占用,可以通过proc文件系统下的smaps查看。

//TODO

//查看脚本

linux 内存pss,内存耗用:VSS/RSS/PSS/USS相关推荐

  1. linux 进程的vss rss uss,内核/内存管理中的VSS/RSS/PSS/USS

    转自:http://www.douban.com/note/161471809/ RSS is the total memory actually held in RAM for a process. ...

  2. 【转】内存耗用:VSS/RSS/PSS/USS

    [转]内存耗用:VSS/RSS/PSS/USS Terms VSS- Virtual Set Size 虚拟耗用内存(包含共享库占用的内存) RSS- Resident Set Size 实际使用物理 ...

  3. 内存耗用:VSS/RSS/PSS/USS

    http://hi.baidu.com/donghaozheng/blog/item/235da701ab70f60a1c95832e.html Terms VSS- Virtual Set Size ...

  4. 内存耗用:VSS/RSS/PSS/USS 介绍

    参考:内存耗用:VSS/RSS/PSS/USS 的介绍 - 简书 内存耗用:VSS/RSS/PSS/USS_adaptiver的博客-CSDN博客_rss uss VSS- Virtual Set S ...

  5. linux 进程pss,Linux 进程内存使用统计VSS RSS PSS USSS

    有的时候我们需要统计不同的进程实际物理内存的消耗,常见的几个参数如下: VSS (reported as VSZ from ps) is the total accessible address sp ...

  6. android 内存uss rss,内存VSS/RSS/PSS/USS名词解释

    VSS(virtual set size)虚拟耗用内存(包含共享库占用的内存) RSS(Resident set size)实际使用物理内存(包含共享库占用的内存) RSS是进程实际驻存在物理内存的部 ...

  7. 内存:VSS/RSS/PSS/USS区别和监控

    软件开发的最后阶段就是测试,了解软件整体的cpu和mem使用情况,之前一直用ps来确定cpu使用率和rss内存,最近监控python多进程软件时,累积rss竟然超过了节点物理内存126G,原因在此处梳 ...

  8. rss C语言,Android内存:VSS/RSS/PSS/USS介绍

    一般来说内存占用大小有如下规律:VSS>=RSS>=PSS>=USS 1.VSS - Virtual Set Size(用处不大) 虚拟耗用内存(包含共享库占用的全部内存,以及分配但 ...

  9. linux中pss用法,[Linux] Memory: VSS/RSS/PSS/USS

    Terms VSS- Virtual Set Size 虚拟耗用内存(包含共享库占用的内存) RSS- Resident Set Size 实际使用物理内存(包含共享库占用的内存) PSS- Prop ...

  10. linux vss rss区别,关于VSS / RSS / PSS / USS的解释是否准确?

    我阅读了有关VSS / RSS / PSS / USS的说明: 这篇文章的目的是提供信息,以帮助解释来自各种工具的内存报告,以便可以确定Linux进程和系统的实际内存使用情况. Android有一个称 ...

最新文章

  1. 深入理解Java虚拟机——第二章——Java内存区域与内存溢出异常
  2. JS获取当前/指定URL参数
  3. windbg 脚本命令实例
  4. 白洁血战Node.js并发编程 01 状态机
  5. 数据结构与算法(6) -- heap
  6. mysql exists依赖查询_MySQL EXISTS 和 NOT EXISTS 子查询
  7. python解决sip与ptqt不兼容导致页面截图引擎无法运行问题
  8. python给一个不多于5位的正整数 要求_python作业题2 给一个不多于5位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字。...
  9. 2020-06-10
  10. 一个B站下载视频的网站
  11. 有监督学习与无监督学习的几大区别
  12. 团队协作工具,如何加强团队协作能力
  13. C++ STL算法adjacent_find(09)
  14. C++将二进制转换为十进制
  15. 如何批量提取过期域名,如何批量查询权重域名、收录域名
  16. 你心心念念的 GitHub手机版APP终于来咯
  17. oracle创建索引指定用户,循序渐进学Oracle之索引、权限、角色
  18. 如何往码云里上传项目文件?
  19. CSS深度学习 - 文本方向 direction 和 dir
  20. TcaplusDBX光与夜之恋|春暖花开之际与你相遇

热门文章

  1. XML的DTD和Schema约束
  2. sudo chown -R nobody:nogroup clear
  3. 整理了一些DataGrid ColumnStyle
  4. 凸优化第五章对偶 5.3 几何解释
  5. Thrift Server与Client
  6. java调用opencv人脸识别 error insufficient out of memory
  7. Mybatis中的foreach
  8. Leetcode(二):Add Two Numbers
  9. 算法篇---java算法应用
  10. web文件操作常见安全漏洞(目录、文件名检测漏洞)