##########################################
################################
[root@qqd218 20829]# more status
Name: httpd
State: S (sleeping)
Tgid: 20829
Pid: 20829
PPid: 20695
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
Utrace: 0
FDSize: 256
Groups: 1000
VmPeak: 101136 kB
VmSize: 94536 kB
VmLck: 0 kB
VmHWM: 43180 kB
VmRSS: 42340 kB
VmData: 54916 kB
VmStk: 100 kB
VmExe: 556 kB
VmLib: 22328 kB
VmPTE: 204 kB
VmSwap: 0 kB
Threads: 1
SigQ: 0/63841
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001000
SigCgt: 000000018c0046eb
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: ffffffffffffffff
Cpus_allowed: ff
Cpus_allowed_list: 0-7
Mems_allowed: 1
Mems_allowed_list: 0
voluntary_ctxt_switches: 22851
或者用命令
pmap 20829
20829: /www/wdlinux/apache/bin/httpd
00110000 1572K r-x-- /lib/libc-2.12.so
00299000 4K ----- /lib/libc-2.12.so
0029a000 8K r---- /lib/libc-2.12.so
0029c000 4K rw--- /lib/libc-2.12.so
0029d000 12K rw--- [ anon ]
002a0000 12K r-x-- /lib/libplds4.so
002a3000 4K rw--- /lib/libplds4.so
0049e000 4K rw--- [ anon ]
0049f000 280K r-x-- /usr/lib/libmhash.so.2.0.1
004e5000 4K rw--- /usr/lib/libmhash.so.2.0.1
004e6000 144K r-x-- /usr/lib/libmcrypt.so.4.4.8
0050a000 12K rw--- /usr/lib/libmcrypt.so.4.4.8
0050d000 20K rw--- [ anon ]
00512000 36K r-x-- /usr/lib/liblt
....
...
...
08c1f000 54568K rw--- [ anon ]
b6776000 7032K rw-s- /dev/zero (deleted)
b6e54000 4K rw--- [ anon ]
b6e55000 512K rw-s- [ shmid=0x128000 ]
b6ed5000 8192K rw-s- /dev/zero (deleted)
b7716000 12K rw--- [ anon ]
b7725000 4K rw--- [ anon ]
bfc1b000 92K rwx-- [ stack ]
bfc33000 0K rw--- [ anon ]
total 94528K
或者yum install -y glibc-utils
#################################
如果要限制某个用户或者进程使用内存的大小
[root@localhost ~]# vi /etc/security/limits.conf
软限制和硬限制。。。。
###########################
#################################
[root@qqd218 jiankong]# pmap -d 1
1: /sbin/init
Address Kbytes Mode Offset Device Mapping
00110000 48 r-x-- 0000000000000000 008:00003 libnss_files-2.12.so
0011c000 4 r---- 000000000000b000 008:00003 libnss_files-2.12.so
0011d000 4 rw--- 000000000000c000 008:00003 libnss_files-2.12.so
0022c000 1572 r-x-- 0000000000000000 008:00003 libc-2.12.so
003b5000 4 ----- 0000000000189000 008:00003 libc-2.12.so
003b6000 8 r---- 0000000000189000 008:00003 libc-2.12.so
003b8000 4 rw--- 000000000018b000 008:00003 libc-2.12.so
003b9000 12 rw--- 0000000000000000 000:00000 [ anon ]
00471000 92 r-x-- 0000000000000000 008:00003 libpthread-2.12.so
00488000 4 r---- 0000000000016000 008:00003 libpthread-2.12.so
00489000 4 rw--- 0000000000017000 008:00003 libpthread-2.12.so
0048a000 8 rw--- 0000000000000000 000:00000 [ anon ]
0057a000 36 r-x-- 0000000000000000 008:00003 libnih-dbus.so.1.0.0
00583000 4 rw--- 0000000000008000 008:00003 libnih-dbus.so.1.0.0
0075a000 28 r-x-- 0000000000000000 008:00003 librt-2.12.so
00761000 4 r---- 0000000000006000 008:00003 librt-2.12.so
00762000 4 rw--- 0000000000007000 008:00003 librt-2.12.so
007fb000 116 r-x-- 0000000000000000 008:00003 libgcc_s-4.4.6-20110824.so.1
00818000 4 rw--- 000000000001d000 008:00003 libgcc_s-4.4.6-20110824.so.1
00a66000 4 r-x-- 0000000000000000 000:00000 [ anon ]
00aba000 276 r-x-- 0000000000000000 008:00003 libdbus-1.so.3.4.0
00aff000 4 r---- 0000000000044000 008:00003 libdbus-1.so.3.4.0
00b00000 4 rw--- 0000000000045000 008:00003 libdbus-1.so.3.4.0
00bf0000 120 r-x-- 0000000000000000 008:00003 ld-2.12.so
00c0e000 4 r---- 000000000001d000 008:00003 ld-2.12.so
00c0f000 4 rw--- 000000000001e000 008:00003 ld-2.12.so
00f85000 96 r-x-- 0000000000000000 008:00003 libnih.so.1.0.0
00f9d000 4 rw--- 0000000000017000 008:00003 libnih.so.1.0.0
08048000 128 r-x-- 0000000000000000 008:00003 init
08068000 4 rw--- 000000000001f000 008:00003 init
09539000 132 rw--- 0000000000000000 000:00000 [ anon ]
b783d000 12 rw--- 0000000000000000 000:00000 [ anon ]
b784c000 4 rw--- 0000000000000000 000:00000 [ anon ]
bf808000 84 rw--- 0000000000000000 000:00000 [ stack ]
mapped: 2840K writeable/private: 292K shared: 0K
最后一行的值
mapped 表示该进程映射的虚拟地址空间大小,也就是该进程预先分配的虚拟内存大小,即ps出的vsz
writeable/private 表示进程所占用的私有地址空间大小,也就是该进程实际使用的内存大小
shared 表示进程和其他进程共享的内存大小