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