如何查看进程实际的内存占用情况详解

2019/7/10 23:27:40

本文主要是介绍如何查看进程实际的内存占用情况详解,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

top命令可以查看进程内存的使用,但是不够详细。还有一些命令可以进行更加详细的查看。

[root@localhost ~]# cat /proc/5606/status
Name:   switch4
State:  S (sleeping)
Tgid:   5606
Pid:    5606
PPid:   1
TracerPid:      0
Uid:    0       0       0       0
Gid:    0       0       0       0
Utrace: 0
FDSize: 32
Groups: 0 1 2 3 4 6 10
VmPeak:    85328 kB
VmSize:    84308 kB——进程占用的虚拟内存大小。
VmLck:         0 kB
VmHWM:     46368 kB
VmRSS:     46360 kB——占用的物理内存。
VmData:    76512 kB——data段内存大小(BSS,data)
VmStk:        88 kB——栈大小。
VmExe:       312 kB——代码段大小。
VmLib:      6868 kB——库大小
VmPTE:       148 kB
VmSwap:        0 kB
Threads:        4
SigQ:   1/31237
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000005
SigCgt: 0000000180005202
CapInh: 0000000000000000
CapPrm: ffffffffffffffff
CapEff: ffffffffffffffff
CapBnd: ffffffffffffffff
Cpus_allowed:   ff
Cpus_allowed_list:      0-7
Mems_allowed:   1
Mems_allowed_list:      0
voluntary_ctxt_switches:        116683469
nonvoluntary_ctxt_switches:     301173


[root@localhost ~]# cat /proc/5627/smaps
00110000-00112000 r-xp 00000000 08:02 652817     /home/mic_lib_2012-04-21-03-16-32/libdb.so
Size:                  8 kB
Rss:                   8 kB
Pss:                   1 kB
Shared_Clean:          8 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:            8 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
00112000-00113000 rw-p 00001000 08:02 652817     /home/mic_lib_2012-04-21-03-16-32/libdb.so
Size:                  4 kB
Rss:                   4 kB
Pss:                   4 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         4 kB
Referenced:            4 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
08048000-080a2000 r-xp 00000000 08:02 1044485    /home/execute_2012-04-21-03-16-32/mrfc
Size:                360 kB——虚拟内存
Rss:                 156 kB——物理内存
Pss:                 156 kB
Shared_Clean:          0 kB——共享部分,动态链接库
Shared_Dirty:          0 kB
Private_Clean:       156 kB——私有部分。
Private_Dirty:         0 kB
Referenced:          156 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
09f43000-09f87000 rw-p 00000000 00:00 0          [heap]——堆的内存
Size:                272 kB
Rss:                 184 kB
Pss:                 184 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:       184 kB
Referenced:          184 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
b6cfc000-b6cfd000 ---p 00000000 00:00 0
Size:                  4 kB
Rss:                   0 kB
Pss:                   0 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:            0 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
b6cfd000-b7703000 rw-p 00000000 00:00 0
Size:              10264 kB
Rss:                  28 kB
Pss:                  28 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:        28 kB
Referenced:           28 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
b7714000-b7716000 rw-p 00000000 00:00 0
Size:                  8 kB
Rss:                   8 kB
Pss:                   8 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         8 kB
Referenced:            8 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
bfed4000-bfee9000 rw-p 00000000 00:00 0          [stack]——栈的内存。
Size:                 88 kB
Rss:                  44 kB
Pss:                  44 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:        44 kB
Referenced:           44 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB



这篇关于如何查看进程实际的内存占用情况详解的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程