You are not logged in.

#1 2008-12-30 16:40:46

tony5429
Member
Registered: 2006-03-28
Posts: 1,020

RAM is Maxing out but ps aux Can't Find the Memory Leak!

What is going on here? "free -m" says I only have 47 MB of free RAM and yet the top memory user according to "ps aux" is mysql, with only 1.2% memory usage! Can anyone help me? I have no ideas at this point....

[root@norpass ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          2009       1962         47          0          0       1849
-/+ buffers/cache:        112       1896
Swap:         4102          0       4102
[root@norpass ~]# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0   3800   628 ?        Ss   Dec25   0:03 init [3]
root         2  0.0  0.0      0     0 ?        S<   Dec25   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S<   Dec25   0:00 [migration/0]
root         4  0.0  0.0      0     0 ?        S<   Dec25   0:00 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   Dec25   0:00 [watchdog/0]
root         6  0.0  0.0      0     0 ?        S<   Dec25   0:00 [migration/1]
root         7  0.0  0.0      0     0 ?        S<   Dec25   0:00 [ksoftirqd/1]
root         8  0.0  0.0      0     0 ?        S<   Dec25   0:00 [watchdog/1]
root         9  0.0  0.0      0     0 ?        S<   Dec25   0:02 [events/0]
root        10  0.0  0.0      0     0 ?        S<   Dec25   0:01 [events/1]
root        11  0.0  0.0      0     0 ?        S<   Dec25   0:00 [khelper]
root        12  0.0  0.0      0     0 ?        S<   Dec25   0:02 [kblockd/0]
root        13  0.0  0.0      0     0 ?        S<   Dec25   0:00 [kblockd/1]
root        14  0.0  0.0      0     0 ?        S<   Dec25   0:00 [kacpid]
root        15  0.0  0.0      0     0 ?        S<   Dec25   0:00 [kacpi_notify]
root        16  0.0  0.0      0     0 ?        S<   Dec25   0:00 [kseriod]
root        17  0.0  0.0      0     0 ?        S    Dec25   0:00 [pdflush]
root        18  0.0  0.0      0     0 ?        S    Dec25   0:04 [pdflush]
root        19  0.0  0.0      0     0 ?        S<   Dec25   0:01 [kswapd0]
root        20  0.0  0.0      0     0 ?        S<   Dec25   0:00 [aio/0]
root        21  0.0  0.0      0     0 ?        S<   Dec25   0:00 [aio/1]
root        35  0.0  0.0      0     0 ?        S<   Dec25   0:00 [ata/0]
root        36  0.0  0.0      0     0 ?        S<   Dec25   0:00 [ata/1]
root        37  0.0  0.0      0     0 ?        S<   Dec25   0:00 [ata_aux]
root        46  0.0  0.0      0     0 ?        S<   Dec25   0:00 [scsi_eh_0]
root        47  0.0  0.0      0     0 ?        S<   Dec25   0:00 [scsi_eh_1]
root        48  0.0  0.0      0     0 ?        S<   Dec25   0:00 [scsi_eh_2]
root        49  0.0  0.0      0     0 ?        S<   Dec25   0:00 [scsi_eh_3]
root       387  0.0  0.0      0     0 ?        S<   Dec25   0:00 [ksuspend_usbd]
root       388  0.0  0.0      0     0 ?        S<   Dec25   0:00 [khubd]
root       575  0.0  0.0      0     0 ?        S<   Dec25   0:00 [xfs_mru_cache]
root       577  0.0  0.0      0     0 ?        S<   Dec25   0:00 [xfslogd/0]
root       578  0.0  0.0      0     0 ?        S<   Dec25   0:00 [xfslogd/1]
root       579  0.0  0.0      0     0 ?        S<   Dec25   0:00 [xfsdatad/0]
root       580  0.0  0.0      0     0 ?        S<   Dec25   0:00 [xfsdatad/1]
root       595  0.0  0.0      0     0 ?        S<   Dec25   0:01 [xfsbufd]
root       596  0.0  0.0      0     0 ?        S<   Dec25   0:00 [xfsaild]
root       597  0.0  0.0      0     0 ?        S<   Dec25   0:00 [xfssyncd]
root       636  0.0  0.0   6236   900 ?        S<s  Dec25   0:00 /sbin/udevd --daemon
root      1539  0.0  0.0      0     0 ?        S<   Dec25   0:00 [kpsmoused]
root      1588  0.0  0.0      0     0 ?        S<   Dec25   0:01 [xfsbufd]
root      1589  0.0  0.0      0     0 ?        S<   Dec25   0:01 [xfsaild]
root      1590  0.0  0.0      0     0 ?        S<   Dec25   0:00 [xfssyncd]
root      2255  0.0  0.0  12880  1140 ?        Ss   Dec25   0:00 /usr/sbin/syslog-ng
root      2322  0.0  0.0   8084   528 ?        Ss   Dec25   0:00 /sbin/dhcpcd -t 30 -h norpass.com eth0
root      2338  0.0  0.0   5880   624 ?        S    Dec25   0:00 /usr/sbin/crond
root      2349  0.0  0.4 215148  8636 ?        Ss   Dec25   0:06 /usr/sbin/httpd -k start
root      2359  0.0  0.0  49736  1220 ?        Ss   Dec25   0:00 /usr/sbin/sshd
root      2369  0.0  0.0  15380  1520 ?        S    Dec25   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql
mysql     2399  0.0  1.2 162760 25816 ?        Sl   Dec25   4:15 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/my
root      2471  0.0  0.1  45320  2256 ?        Ss   Dec25   0:00 /usr/lib/postfix/master
root      2476  0.0  0.0   3796   584 tty1     Ss+  Dec25   0:00 /sbin/agetty -8 38400 vc/1 linux
root      2477  0.0  0.0   3796   584 tty2     Ss+  Dec25   0:00 /sbin/agetty -8 38400 vc/2 linux
root      2479  0.0  0.0   3796   584 tty3     Ss+  Dec25   0:00 /sbin/agetty -8 38400 vc/3 linux
root      2480  0.0  0.0   3796   580 tty4     Ss+  Dec25   0:00 /sbin/agetty -8 38400 vc/4 linux
root      2482  0.0  0.0   3796   580 tty5     Ss+  Dec25   0:00 /sbin/agetty -8 38400 vc/5 linux
root      2483  0.0  0.0   3796   584 tty6     Ss+  Dec25   0:00 /sbin/agetty -8 38400 vc/6 linux
postfix   2485  0.0  0.1  45456  2376 ?        S    Dec25   0:00 qmgr -l -t fifo -u
root      2590 28.7  0.0   6552   988 ?        R    Dec25 2016:23 ./ramsat_sim
root      2592 29.3  0.0   6516   976 ?        R    Dec25 2054:43 ./ramsat_sim
root      2594 28.3  0.0   6896  1256 ?        R    Dec25 1986:08 ./ramsat_sim
root      2596 28.4  0.0   7176  1620 ?        R    Dec25 1989:00 ./ramsat_sim
root      2600 28.3  0.4  16964 10236 ?        R    Dec25 1984:32 ./ramsat_sim
http     11398  0.0  0.2 203364  4196 ?        S    Dec28   0:00 /usr/sbin/httpd -k start
http     14110  0.0  0.3 215680  6600 ?        S    Dec29   0:00 /usr/sbin/httpd -k start
http     14115  0.0  0.3 215736  7332 ?        S    Dec29   0:00 /usr/sbin/httpd -k start
http     14117  0.0  0.3 215680  7296 ?        S    Dec29   0:00 /usr/sbin/httpd -k start
http     15221  0.0  0.3 215420  7100 ?        S    09:16   0:00 /usr/sbin/httpd -k start
http     15222  0.0  0.2 215284  6100 ?        S    09:16   0:00 /usr/sbin/httpd -k start
http     15223  0.0  0.3 215284  6296 ?        S    09:16   0:00 /usr/sbin/httpd -k start
http     15224  0.0  0.3 215284  6380 ?        S    09:16   0:00 /usr/sbin/httpd -k start
http     15226  0.0  0.3 215680  6516 ?        S    09:16   0:00 /usr/sbin/httpd -k start
http     15227  0.0  0.3 215420  7060 ?        S    09:16   0:00 /usr/sbin/httpd -k start
postfix  15569  0.0  0.1  45396  2208 ?        S    15:29   0:00 pickup -l -t fifo -u
http     15703  0.0  0.2 215284  5292 ?        S    16:25   0:00 /usr/sbin/httpd -k start
root     15736  0.0  0.1  64876  3144 ?        Ss   16:33   0:00 sshd: root@pts/1
root     15738  0.0  0.1  17048  2152 pts/1    Ss   16:33   0:00 -bash
root     15755  0.0  0.0   9816  1152 pts/1    R+   16:39   0:00 ps aux
[root@norpass ~]#

Offline

#2 2008-12-30 16:47:54

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

You have 112MBs of RAM reserved:

-/+ buffers/cache:        112

All the rest of it is cached or buffered. From here everything looks fine.

Offline

#3 2008-12-30 16:53:55

kjon
Member
From: Temuco, Chile
Registered: 2008-04-16
Posts: 398

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

do you come from windows? don't you?
As phrakture said on a previous post: -"If your ram isn't used, you're wasting your money"-
(I can't recall exactly what was the phrase he used, but the idea remains being the same).

Don't worry about the cache, it will fill up as you're doing 'nothing'. The memory will be freeded as long as you use a memory intensive application.

I'll give you a hint: ps is a very good tool, however, it kinda unfriendly with the mere mortals. Pick htop, for instance, and you will see your processes and related stuff in a more human format big_smile (but what you choose is up to you)

Last edited by kjon (2008-12-30 16:54:13)


They say that if you play a Win cd backward you hear satanic messages. That's nothing! 'cause if you play it forwards, it installs windows.

Offline

#4 2008-12-30 16:59:11

andre.ramaciotti
Member
From: Brazil
Registered: 2007-04-06
Posts: 649

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

[root@norpass ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          2009       1962         47          0          0       1849
-/+ buffers/cache:        112       1896
Swap:         4102          0       4102

Reading the second line, you'll see how much of RAM you're using without considerating the cache. So your apps are using 112MB and you have 1896MB free. Don't worry about the cache being that large, it increases performance when reading a file from disc (beause it's actually on the RAM) and the kernel will erase it if needed.


(lambda ())

Offline

#5 2008-12-30 17:02:43

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

That is one huge swap.

Offline

#6 2008-12-30 17:16:22

tony5429
Member
Registered: 2006-03-28
Posts: 1,020

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

Thanks everyone! That makes a lot more sense. Yes, kjon, I do come from windows. But please don't reference my troubled past. Actually, I typically use "ps aux | sort -n +3 | tail -1" rather than simply "ps aux" - I just wanted to make sure I wasn't missing something by looking at only the top memory-user. Glad to know there's no massive memory leak in my system smile

Procyon, what's wrong with a huge swap? Wouldn't you do it too if you were given a system with 200GB hdd more than necessary and told to make a webserver?

[root@norpass ~]# df -H
Filesystem             Size   Used  Avail Use% Mounted on
/dev/sda3              7.9G   1.1G   6.8G  14% /
none                   1.1G      0   1.1G   0% /dev/shm
/dev/sda1               40M   9.9M    28M  27% /boot
/dev/sda4              238G   4.5G   234G   2% /home

Offline

#7 2008-12-30 18:19:45

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

tony5429 wrote:

Procyon, what's wrong with a huge swap? Wouldn't you do it too if you were given a system with 200GB hdd more than necessary and told to make a webserver?

With 2GB of RAM? Not really.. You wont gain anything with 4GB of swap and you certainly don't want your webserver to be swapping a lot. If you're tight on memory, I'd suggest buying more memory instead of a large swap partition. (But your situation doesn't look too tight, so I'd suggest kicking the swap wink )

Offline

#8 2008-12-30 18:29:32

tony5429
Member
Registered: 2006-03-28
Posts: 1,020

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

Hm...it won't access the swap unless it runs out of memory - correct?

Offline

#9 2008-12-30 18:32:00

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

Correct.

Offline

#10 2008-12-30 18:59:47

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

if you use hibernate you need swap


Give what you have. To someone, it may be better than you dare to think.

Offline

#11 2008-12-30 19:53:51

kludge
Member
Registered: 2008-08-03
Posts: 294

Re: RAM is Maxing out but ps aux Can't Find the Memory Leak!

sure, but (a) not on a webserver and (b) not 2x2GB!!!


[23:00:16]    dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32]    dr_kludge | can you guess what i'd call it?
[23:01:16]    dr_kludge | nosilla.
[23:01:32]    dr_kludge | i really should be going to bed.  i'm giggling madly about that.

Offline

Board footer

Powered by FluxBB