xxnimu 发表于 2010-6-2 08:50:55

为什么内存使用这么高?

http://i3.6.cn/cvbnm/a0/00/b0/0c55f8be82bc3610f13d44183394b8b3.jpg


free -m
================================================================
total       used       free   shared    buffers   cached
Mem:          2016       1952         64          0      256       1356
-/+ buffers/cache:      338       1677
Swap:         4000          0       4000


ps -aus
==================================================================
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         10.00.0   2072   628 ?      Ss   May31   0:00 init
root         20.00.0      0   0 ?      S<   May31   0:00
root         30.00.0      0   0 ?      SN   May31   0:00
root         40.00.0      0   0 ?      S<   May31   0:00
root         50.00.0      0   0 ?      S<   May31   0:00
root         60.00.0      0   0 ?      SN   May31   0:00
root         70.00.0      0   0 ?      S<   May31   0:00
root         80.00.0      0   0 ?      S<   May31   0:00
root         90.00.0      0   0 ?      S<   May31   0:00
root      100.00.0      0   0 ?      S<   May31   0:00
root      110.00.0      0   0 ?      S<   May31   0:00
root      150.00.0      0   0 ?      S<   May31   0:00
root      160.00.0      0   0 ?      S<   May31   0:00
root      170.00.0      0   0 ?      S<   May31   0:00
root       1160.00.0      0   0 ?      S<   May31   0:00
root       1170.00.0      0   0 ?      S<   May31   0:00
root       1200.00.0      0   0 ?      S<   May31   0:00
root       1220.00.0      0   0 ?      S<   May31   0:00
root       1890.00.0      0   0 ?      S    May31   0:05
root       1910.00.0      0   0 ?      S<   May31   0:01
root       1920.00.0      0   0 ?      S<   May31   0:00
root       1930.00.0      0   0 ?      S<   May31   0:00
root       3520.00.0      0   0 ?      S<   May31   0:00
root       3820.00.0      0   0 ?      S<   May31   0:00
root       3830.00.0      0   0 ?      S<   May31   0:00
root       3840.00.0      0   0 ?      S<   May31   0:00
root       3880.00.0      0   0 ?      S<   May31   0:00
root       3890.00.0      0   0 ?      S<   May31   0:00
root       3960.00.0      0   0 ?      S<   May31   0:00
root       4090.00.0      0   0 ?      S<   May31   0:23
root       4390.00.0      0   0 ?      S<   May31   0:00
root       4720.00.0   28801484 ?      S<sMay31   0:00 /sbin/udevd -d
root      11740.00.0      0   0 ?      S<   May31   0:00
root      13720.00.0      0   0 ?      S<   May31   0:00
root      13730.00.0      0   0 ?      S<   May31   0:00
root      13740.00.0      0   0 ?      S<   May31   0:00
root      14000.00.0      0   0 ?      S<   May31   0:00
root      16040.00.0      0   0 ?      S<   May31   0:05
root      16050.00.0      0   0 ?      S<   May31   0:05
root      17230.00.0   2164   508 ?      Ss   May31   0:01 mcstransd
rpc       20040.00.0   1812   552 ?      Ss   May31   0:00 portmap
root      20340.00.0      0   0 ?      S<   May31   0:00
root      20350.00.0      0   0 ?      S<   May31   0:00
root      20930.00.0   60961320 ?      Ss   May31   0:00 nginx: master process /usr/local/nginx/sbin/nginx
dbus      20990.00.0131241364 ?      SslMay31   0:00 dbus-daemon --system
root      21150.00.543804 11948 ?      SslMay31   0:02 /usr/bin/python -E /usr/sbin/setroubleshootd
root      21280.00.0   2168   764 ?      Ss   May31   0:00 /usr/sbin/hcid
root      21320.00.0   1744   508 ?      Ss   May31   0:00 /usr/sbin/sdpd
root      21560.00.0      0   0 ?      S<   May31   0:00
68      22310.00.1   57203920 ?      Ss   May31   0:00 hald
root      22320.00.0   31521084 ?      S    May31   0:00 hald-runner
68      22400.00.0   2016   828 ?      S    May31   0:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.so
root      22720.00.0   1912   448 ?      Ss   May31   0:00 /usr/bin/hidd --server
root      23520.00.0   2724   852 ?      Ss   May31   0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
root      23970.00.0   1900   468 ?      Ss   May31   0:00 gpm -m /dev/input/mice -t exps2
xfs       24370.00.0   35361328 ?      Ss   May31   0:00 xfs -droppriv -daemon
root      25080.00.525652 10372 ?      SN   May31   0:00 /usr/bin/python -tt /usr/sbin/yum-updatesd
root      25100.00.0   25561172 ?      SN   May31   0:00 /usr/libexec/gam_server
root      25270.00.0   3504   520 ?      S    May31   0:00 /usr/sbin/smartd -q never
root      25300.00.0   1660   444 tty1   Ss+May31   0:00 /sbin/mingetty tty1
root      25310.00.0   1660   448 tty2   Ss+May31   0:00 /sbin/mingetty tty2
root      25320.00.0   1660   448 tty3   Ss+May31   0:00 /sbin/mingetty tty3
root      25330.00.0   1660   444 tty4   Ss+May31   0:00 /sbin/mingetty tty4
root      25340.00.0   1660   448 tty5   Ss+May31   0:00 /sbin/mingetty tty5
root      25350.00.0   1660   448 tty6   Ss+May31   0:00 /sbin/mingetty tty6
root      25920.00.1   99162856 ?      Ss   May31   0:00 sshd: root@pts/0
root      25940.00.0   45321452 pts/0    Ss+May31   0:00 -bash
root      31340.00.0   1728   612 ?      Ss   May31   0:01 syslogd -m 0
root      31370.00.0   1680   404 ?      Ss   May31   0:00 klogd -x
root      34480.00.0      0   0 ?      S    Jun01   0:00
root      40780.00.0   7228   856 ?      Ss   Jun01   0:00 pure-ftpd (SERVER)
root      43270.00.512160 10416 ?      Ss   May31   0:00 /usr/sbin/restorecond
root      43740.00.0272561364 ?      SslMay31   0:00 automount
root      44200.00.012520   768 ?      S<sl May31   0:00 auditd
root      44220.00.012076   696 ?      S<sl May31   0:00 /sbin/audispd
root      44550.00.0   92321904 ?      Ss   May31   0:00 sendmail: accepting connections
smmsp   44640.00.0   81481520 ?      Ss   May31   0:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
root      45340.00.1101242332 ?      Ss   May31   0:00 cupsd
root      45700.00.0   1676   528 ?      Ss   May31   0:00 /usr/sbin/acpid
root      46210.00.0128601380 ?      SslMay31   0:00 pcscd
root      46410.00.0   2268   440 ?      Ss   May31   0:00 /usr/sbin/atd
root      47310.00.0   70761060 ?      Ss   May31   0:00 /usr/sbin/sshd
root      47660.00.0   5816   644 ?      Ss   May31   0:00 rpc.idmapd
rpcuser   48110.00.0   1868   736 ?      Ss   May31   0:00 rpc.statd
avahi   48440.00.0   25921280 ?      Ss   May31   0:00 avahi-daemon: running
avahi   48450.00.0   2592   428 ?      Ss   May31   0:00 avahi-daemon: chroot helper
root      48920.00.0   52881184 ?      Ss   May31   0:00 crond
root   173710.00.1100923008 ?      Ss   08:32   0:00 sshd: root@pts/1
root   173760.00.0   46401488 pts/1    Ss   08:32   0:00 -bash
www      180531.41.740520 35156 ?      D    08:42   0:03 nginx: worker process
root   180910.00.0   44921132 pts/1    S    08:42   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/loca
mysql    181940.90.3377487968 pts/1    Sl   08:42   0:02 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql -
root   182080.00.2232284176 ?      Ss   08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      182090.00.3235966764 ?      S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      182100.00.2232286108 ?      S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      182110.00.2235806148 ?      S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      182120.00.2235726116 ?      S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      182130.00.2232286024 ?      S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
root   186070.00.0   4260   952 pts/1    R+   08:47   0:00 ps -aux

[ 本帖最后由 xxnimu 于 2010-6-2 08:53 编辑 ]

licess 发表于 2010-6-2 09:32:35

回复 1# 的帖子

首先你要搞清楚的是Linux和Windows的内存机制是不一样的。

在Linux中经常发现空闲内存很少,似乎所有的内存都被系统占用了,表面感觉是内存不够用了,其实不然。这是Linux内存管理的一个优秀特性,在这方面,区别于 Windows的内存管理。主要特点是,无论物理内存有多大,Linux 都将其充分利用,将一些程序调用过的硬盘数据读入内存,利用内存读写的高速特性来提高Linux系统的数据访问性能。而Windows 是只在需要内存时,才为应用程序分配内存,并不能充分利用大容量的内存空间。换句话说,每增加一些物理内存,Linux 都将能充分利用起来,发挥了硬件投资带来的好处,而Windows只将其做为摆设,即使增加8GB甚至更大。
Linux 的这一特性,主要是利用空闲的物理内存,划分出一部份空间,做为 cache 和 buffers ,以此提高数据访问性能。

haojay 发表于 2010-6-3 16:25:56

这也是我一直在纳闷的
现在终于明白了:lol

licess 发表于 2010-6-3 21:59:38

回复 3# 的帖子

:lol
页: [1]
查看完整版本: 为什么内存使用这么高?