Memory usage

Ask questions regarding Gentoox, Gentoo and Linux in general in these forums and we'll do our best to help you!
Post Reply
clpalmer
Power user
Posts: 288
Joined: Sat Jan 29, 2005 6:38 pm

Memory usage

Post by clpalmer »

Are there processes that use memory that won't show up in "top" or "ps aux"? I'm trying to figure out what's using so much memory. Here's the output of "top":

Tasks: 38 total, 1 running, 37 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3% user, 0.0% system, 0.0% nice, 99.7% idle
Mem: 122884k total, 68628k used, 54256k free, 23452k buffers
Swap: 249992k total, 0k used, 249992k free, 31356k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3625 root 19 0 1040 1040 828 R 0.3 0.8 0:00.13 top
1 root 9 0 476 476 428 S 0.0 0.4 0:04.30 init
2 root 8 0 0 0 0 S 0.0 0.0 0:00.00 keventd
4 root 19 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd_CPU0
3 root 9 0 0 0 0 S 0.0 0.0 0:00.00 xbox_extsmi
5 root 9 0 0 0 0 S 0.0 0.0 0:00.00 kswapd
6 root 9 0 0 0 0 S 0.0 0.0 0:00.00 bdflush
7 root 9 0 0 0 0 S 0.0 0.0 0:00.02 kupdated
9 root 9 0 0 0 0 S 0.0 0.0 0:00.00 khubd
12 root 9 0 0 0 0 S 0.0 0.0 0:00.01 xbox_extsmi
24 root 9 0 0 0 0 S 0.0 0.0 0:00.00 kreiserfsd
176 root 9 0 932 932 640 S 0.0 0.8 0:00.01 devfsd
691 root 9 0 452 452 404 S 0.0 0.4 0:00.00 dhcpcd
1160 root 9 0 600 600 504 S 0.0 0.5 0:00.16 syslogd
1175 root 9 0 456 456 376 S 0.0 0.4 0:00.00 klogd
1203 root 8 0 608 608 520 S 0.0 0.5 0:00.00 crond
1343 root 9 0 516 516 460 S 0.0 0.4 0:00.00 dhcpcd
1395 named 9 0 2460 2456 1876 S 0.0 2.0 0:00.01 named
1405 named 9 0 2460 2456 1876 S 0.0 2.0 0:00.00 named
1406 named 9 0 2460 2456 1876 S 0.0 2.0 0:00.02 named
1407 named 9 0 2460 2456 1876 S 0.0 2.0 0:00.00 named
1408 named 9 0 2460 2456 1876 S 0.0 2.0 0:00.00 named
1411 dhcp 9 0 1480 1480 892 S 0.0 1.2 0:00.00 dhcpd
1493 root 9 0 476 476 424 S 0.0 0.4 0:00.00 fanctl
1534 root 9 0 488 488 428 S 0.0 0.4 0:00.00 gpm
1784 root 9 0 1496 1492 1168 S 0.0 1.2 0:00.03 master
1800 postfix 9 0 1460 1456 1152 S 0.0 1.2 0:00.00 pickup
1801 postfix 9 0 1504 1500 1184 S 0.0 1.2 0:00.01 qmgr
1840 root 9 0 1988 1984 1844 S 0.0 1.6 0:00.00 smbd
1843 root 9 0 1976 1972 1832 S 0.0 1.6 0:00.00 smbd
1844 root 9 0 1448 1448 1132 S 0.0 1.2 0:00.01 nmbd
3064 root 9 0 1516 1516 1248 S 0.0 1.2 0:00.00 sshd
3121 root 9 0 892 892 748 S 0.0 0.7 0:00.01 xinetd
3181 root 10 0 620 620 536 S 0.0 0.5 0:00.67 hts
3190 root 9 0 580 580 512 S 0.0 0.5 0:00.01 agetty
3191 root 9 0 580 580 512 S 0.0 0.5 0:00.00 agetty
3616 root 12 0 1940 1940 1552 S 0.0 1.6 0:00.11 sshd
3620 root 10 0 1256 1256 1020 S 0.0 1.0 0:00.03 bash


It seems to state that 68MB of memory is used, but if you add up the %MEM column, it's only like 30%, which should be closer to 40MB. Anyone know why there's this discrepancy? Kernel memory usage?

Also, what's the normal memory usage for gentoox (I know I have named and smbd/nmbd running so it'll use more) right after bootup?
clpalmer
Power user
Posts: 288
Joined: Sat Jan 29, 2005 6:38 pm

Post by clpalmer »

Just noticed the "buffers/cache" line from free -k. Anyone able to explain a bit on buffers and cached memory? Are these allocated and unavailable for use or is ie. cached memory just cached HD hits and will free as the memory is needed for applications?

total used free shared buffers cached
Mem: 122884 90144 32740 0 38500 36608
-/+ buffers/cache: 15036 107848
Swap: 249992 0 249992
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

Cache/ buffers are used to speed up disk access/ programme execution. It's basically code that gets loaded into memory because it is frequently accessed. If it wasnt in memory, the kernel would need to keep issuing page faults/ disk IO requests to load the data from the disk/ swap into memory... this is hellishly slow, instead it gets "buffered". If programmes actually need more RAM themselves, the kernel reduces the buffer size and purges some of the data from it. When more RAM becomes available, the kernel then increases the buffer size and loads more data into it:

http://homepages.feis.herts.ac.uk/~cs2_ ... 0000000000

Why could I recite that from memory? It was part of the studying I did for one of the exams I just had ;)
The original Xbox adaptation of Gentoo
clpalmer
Power user
Posts: 288
Joined: Sat Jan 29, 2005 6:38 pm

Post by clpalmer »

Cool, thanks =)
Post Reply