Memory: VSS/RSS/PSS/USS

【k8s pod container内存指标说明】 容器的工作集使用量作为内存使用量的观察项,但随着后续使用过程中发现该指标上升到一定大小后就会维持不变,并不像应用实际内存使用量,没出现波动;问题剖析 阅读详情

From: http://netcome.javaeye.com/blog/746793

 

Terms
VSS - Virtual Set Size 虚拟耗用内存(包含共享库占用的内存)
RSS - Resident Set Size 实际使用物理内存(包含共享库占用的内存)
PSS - Proportional Set Size 实际使用的物理内存(比例分配共享库占用的内存)
USS - Unique Set Size 进程独自占用的物理内存(不包含共享库占用的内存)
一般来说内存占用大小有如下规律:VSS >= RSS >= PSS >= USS
 
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 leaks in a process.
 
For systems that have Python available, there is also a nice tool called smem that will report memory statistics including all of these categories.
 
# procrank
procrank
PID      Vss      Rss      Pss      Uss cmdline
481   31536K   30936K   14337K    9956K system_server
475   26128K   26128K   10046K    5992K zygote
526   25108K   25108K    9225K    5384K android.process.acore
523   22388K   22388K    7166K    3432K com.android.phone
574   21632K   21632K    6109K    2468K com.android.settings
521   20816K   20816K    6050K    2776K jp.co.omronsoft.openwnn
474    3304K    3304K    1097K     624K /system/bin/mediaserver
37     304K     304K     289K     288K /sbin/adbd
29     720K     720K     261K     212K /system/bin/rild
601     412K     412K     225K     216K procrank
   1     204K     204K     185K     184K /init
35     388K     388K     182K     172K /system/bin/qemud
284     384K     384K     160K     148K top
27     376K     376K     148K     136K /system/bin/vold
261     332K     332K     123K     112K logcat
33     396K     396K     105K      80K /system/bin/keystore
32     316K     316K     100K      88K /system/bin/installd
269     328K     328K      95K      72K /system/bin/sh
26     280K     280K      93K      84K /system/bin/servicemanager
45     304K     304K      91K      80K /system/bin/qemu-props
34     324K     324K      91K      68K /system/bin/sh
260     324K     324K      91K      68K /system/bin/sh
600     324K     324K      91K      68K /system/bin/sh
25     308K     308K      88K      68K /system/bin/sh
28     232K     232K      67K      60K /system/bin/debuggerd

嵌入式和服务器Linux系统下free -m Memory统计信息解析(VSS/RSS/PSS/USS) 由于MAP_SHARED FLAG的匿名页面,用的vm_ops是shmem_vm_ops,其PAGE FAULT中是从SHMEM分配页面的,其调用路径上的关键函数shmem_add_to_page_cache:将分配的页面增加到了NR_FILE_PAGES和NR_SHMEM上面:所以可以得到,SHARED的确实是BUFF/CACHE的一部分,不是USED的一部分,最早的说法更对。 阅读详情

相关推荐

C/C++跨平台获取进程内存:VSS、RSS、USS原理与实现

进程内存管理是操作系统和系统编程的核心概念,它决定了程序如何分配和使用物理及虚拟内存资源。其基本原理涉及虚拟地址空间、物理页帧映射以及内存共享机制。理解这些原理对于性能调优、资源监控和稳定性保障具有重要技术价值,尤其在开发后台服务、性能监控工具和资源管理组件时。在实际应用场景中,开发者常需通过编程方式精确获取进程的内存消耗指标,如虚拟内存大小(VSS)、物理驻留集(RSS)和独占物理内存(USS),以排查内存泄漏或实现资源监视器。本文聚焦于跨平台(Windows/Linux)获取这些关键内存指标的具体实现方

weixin_34195546的博客 913

名词解释:Linux内存管理之RSS和VSZ

Linux内存管理中不管是top命令还是pmap命令,都会有RSS和VSZ这两个名词,这里解释一下: RSS( Resident Set Size )常驻内存集合大小,表示相应进程在RAM中占用了...

cuanraoyi1969的博客 2326

使用python统计Android应用内存以及CPU占用

内存占用 VSS- Virtual Set Size 虚拟耗用内存(包含共享库占用的内存) RSS- Resident Set Size 实际使用物理内存(包含共享库占用的内存) PSS- Proportional Set Size 实际使用的物理内存(比例分配共享库占用的内存) USS- Unique Set Size 进程独自占用的物理内存(不包含共享库占用的内存) 获取USS:procra...

weixin_43835637的博客 3166

redis info命令 memory内存信息说明

源文地址 https://www.runoob.com/redis/server-info.html memory : 内存信息,包含以下域: used_memory : 由 Redis 分配器分配的内存总量,以字节(byte)为单位 used_memory_human : 以人类可读的格式返回 Redis 分配的内存总量 used_memory_rss : 从操作系统的角度,返回 Redis 已分配的内存总量(俗称常驻集大小)。这个值和 top 、 ps 等命令的输出一致。 used_memory_.

wejack的专栏 3362

解决Android 14兼容性问题:NDK中arm64-v8a的正确配置方法

本文详细解析Android 14系统架构变化对NDK开发的影响,重点介绍arm64-v8a架构的正确配置方法。针对常见的兼容性问题如so库缺失、ABI不匹配等提供解决方案,并分享性能优化与自动化测试实践,助力开发者高效适配Android 14设备。

algae的博客 1219

《物联网技术》课程笔记——第二章 物联网技术架构

文章目录第二章:物联网技术架构1 物联网技术体系(C3SD)2 系统体系结构的基本概念3 物联网体系结构——信息传递视角3.1物联网感知层3.1.1 感知层要解决的问题3.1.2 感知层的形态3.1.3 节点的感知能力与控制能力3.1.4 感知层实例3.2 物联网网络层3.2.1 网络相关概念3.2.2 IPV6与IPV4相比互联网协议的升级3.2.3 计算机网络的逻辑层次3.2.4 传输网的拓扑结构3.2.4.1 举例:智能小区的三表采集系统3.2.4.2 接入层3.2.4.2 汇聚层3.2.4.2 核心

南京大学软件工程硕士在读 2503

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

TermsVSS- Virtual Set Size虚拟耗用内存(包含共享库占用的内存)RSS- Resident Set Size实际使用物理内存(包含共享库占用的内存)PSS- Proportional Set Size实际使用的物理内存(比例分配共享库占用的内存)USS- Unique Set Size进程独自占用的物理内存(不包含共享库占用的内存)一般来说内存占用大小有如下规律:VSS&g...

weixin_30495469的博客 648

【GameFramework框架内置模块】10、本地化(Localization)

本地化(Localization),也就是我们所说的不同地区的语言适配,比如说中文版“你好”,英文版是“Hello”。GameFramework在本地化方面,不仅支持文本的本地化,还支持任意资源的本地化,比如说游戏中释放烟花的特效也可以做出不同地区的版本,使得中文版烟花里面的“新年好”字样的特效,在英文版里面是“Happy New Year”字样的特效。

优快云博客专家,Unity3D高级软件工程师,《Unity 3D从入门到实战》作者。 2298

Android内存之VSS/RSS/PSS/USS

Terms VSS- Virtual Set Size 虚拟耗用内存(包含共享库占用的内存) RSS- Resident Set Size 实际使用物理内存(包含共享库占用的内存) PSS- Proportional Set Size 实际使用的物理内存(比例分配共享库占用的内存) USS- Unique Set Size 进程独自占用的物理内存(不包含共享库占用的内存) 一般来说内存占用大小...

chqj_163的专栏 687

GEE APP:基于GEE的红树林监测平台

本文将介绍如何利用Google Earth Engine平台,结合Landsat系列卫星影像和SRTM高程数据,实现红树林分布的动态监测与变化分析。

此星光明博客 160

YOLOv11 改进 - 下采样 | 轻量化突破:ADown 下采样让 YOLOv11 参量减、精度升

本文介绍了一种轻量级的特征下采样模块 ADown,它结合平均池化与最大池化策略,实现更有效的信息保留与压缩。在传统卷积网络中,特征下采样常造成信息损失,而 ADown 通过双通道并行结构优化了下采样效果,提升了模型的表达能力。在 YOLOv11 中引入 ADown 替换原有的下采样模块后,网络在保持高效性的同时,显著提升了目标检测的精度与稳定性。文章详细介绍了 ADown 的核心代码实现、模块注册流程以及 YOLOv11-ADown 模型的配置和训练方法,为轻量化目标检测模型的优化提供了实用参考。

魔改工程师的博客 1480

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

转:http://blog.youkuaiyun.com/adaptiver/article/details/7084364TermsVSS- Virtual Set Size 虚拟耗用内存(包含共享库占用的内存) RSS- Resident Set Size 实际使用物理内存(包含共享库占用的内存) PSS- Proportional Set Size 实际使用的物理内存(比例分配共享库占用的内存) U

Kingous-惊蛰 639

【华为OD技术面试真题 - 技术面】- python面试题(1)

华为OD面试技术面准备指南 华为OD面试技术面常见问题解答 华为OD面试技术面经验分享 华为OD面试技术面注意事项 华为OD面试技术面攻略 华为OD面试技术面模拟题目与解析 华为OD面试技术面知识点梳理 华为OD面试技术面常考

算法大师! 5532

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.RSS can be misleading, because it reports the total all of the shared libraries that the process uses...

weixin_39614637的博客 189

NLP高频面试题(一)——Transformer的基本结构、作用和代码实现

本文详细介绍了Transformer模型的基本结构和PyTorch代码实现过程。首先解析了Transformer的核心组成部分,包括嵌入层、多头自注意力机制、位置编码、前馈神经网络、编码器和解码器等模块,并通过清晰的代码示例逐步展示了如何在PyTorch中构建完整的Transformer模型。文末提供了一个可运行的简单示例,帮助读者快速理解并实践Transformer的核心原理与实现方法。

WeLearnNLP 1026

支付宝h5参数如何实现跳转?(包含相关Demo代码)

🏆本文收录于专栏,主要记录项目实战过程中所遇到的Bug或因后果及提供真实有效的解决方案,希望能够助你一臂之力,帮你早日登顶实现财富自由🚀;同时,欢迎大家!持续更新中,up!up!up!!

**My Coding Family** 3245

android memory详解

了解系统详细的memory使用的情况

qq_34694875的博客 1337

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

上一篇: New Gingerbread API: StrictMode
下一篇: Linux进程虚拟内存和物理内存
CodeJoker
博客等级 码龄18年 50粉丝 37原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值