Linux pmap 进程内存分析
Linux pmap
[root@hankyoon ~]# pmap --help Usage: pmap [options] PID [PID ...] Options: -x, --extended show details 显示扩展格式 -X show even more details WARNING: format changes according to /proc/PID/smaps -XX show everything the kernel provides -c, --read-rc read the default rc -C, --read-rc-from=<file> read the rc from file -n, --create-rc create new default rc -N, --create-rc-to=<file> create new rc to file NOTE: pid arguments are not allowed with -n, -N -d, --device show the device format 显示设备格式 -q, --quiet do not display header and footer 不显示头尾行 -p, --show-path show path in the mapping -A, --range=<low>[,<high>] limit results to the given range -h, --help display this help and exit -V, --version output version information and exit 显示版本信息 For more details see pmap(1).
输出信息详解
Address 内存分配地址
Kbytes Mode 实际分配的内存大小
Offset 文件偏移
Device 设备名
Mapping 分配该内存的模块的名称,[anon]为已分配内存[stack]为程序堆栈
RSS 程序实际占用内存大小
Dirty 脏页大小
Mode 映像权限
输出最后一行的值详解
mapped:表示该进程映射的虚拟地址空间大小,也就是该进程预先分配的虚拟内存大小,即ps出的vsz writeable/private:表示进程所占用的私有地址空间大小,也就是该进程实际使用的内存大小 shared:表示进程和其他进程共享的内存大小
循环显示进程65078的设备格式的最后1行,间隔2秒
[root@hankyoon ~]# while true; do pmap -d 65078 | tail -1; sleep 2; done mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K mapped: 5412K writeable/private: 2028K shared: 0K
分类:
Linux
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」