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