where is all of my memory going?
I'm running MythTV on an Athlon 2800 with a gig of RAM. I'm recording HDTV so I have a lot of data flying back and forth but I should have enough horsepower to handle it. When I run 'top' I can see that I am using a ton of memory and sometimes my box has to resort to the swap partition. I have a couple of questions regarding the top output (below) because things don't seem to add up.
- What is the difference in active vs inactive memory. Is inactive memory that is allocated but just not being used at the moment? - Are all these kdeinit processes normal (I;m on KDE 3.1) and does X normally consume over 130M of memory? - My million dollar question is who is using all of this memory because if I total up the amount used by all of these process I don't get anywhere near 963372k used. /proc/meminfo shows me that 738M is cached but what process is caching it. [mythtv@mythtv mythtv]# cat /proc/meminfo total: used: free: shared: buffers: cached: Mem: 1057517568 1000505344 57012224 0 95666176 738111488 Swap: 1077501952 26238976 1051262976 MemTotal: 1032732 kB MemFree: 55676 kB MemShared: 0 kB Buffers: 93424 kB Cached: 715008 kB SwapCached: 5804 kB Active: 115956 kB Inactive: 776868 kB HighTotal: 131008 kB HighFree: 2360 kB LowTotal: 901724 kB LowFree: 53316 kB SwapTotal: 1052248 kB SwapFree: 1026624 kB [mythtv@mythtv mythtv]# "top" output: 01:06:53 up 1 day, 1:55, 8 users, load average: 0.05, 0.23, 0.37 83 processes: 80 sleeping, 2 running, 1 zombie, 0 stopped CPU states: cpu user nice system irq softirq iowait idle total 0.7% 0.0% 0.5% 0.0% 0.0% 0.0% 98.6% Mem: 1032732k av, 963372k used, 69360k free, 0k shrd, 92736k buff 111888k active, 771992k inactive Swap: 1052248k av, 25624k used, 1026624k free 706948k cached PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND 12471 mythtv 15 0 36848 35M 16812 S 0.0 3.5 0:33 0 mozilla-bin 12027 mythtv 25 10 16780 16M 9468 S N 0.0 1.6 0:03 0 rhn-applet-gu 12780 mythtv 16 0 16156 15M 11348 S 0.0 1.5 0:04 0 konsole 12846 mythtv 16 0 16156 15M 11348 S 0.0 1.5 0:01 0 konsole 11970 mythtv 15 0 13920 13M 12568 S 0.0 1.3 0:00 0 kdeinit 11992 mythtv 15 0 16128 13M 11056 S 0.1 1.3 0:03 0 kdeinit 11990 mythtv 15 0 15256 12M 10804 S 0.0 1.2 0:01 0 kdeinit 11984 mythtv 16 0 15012 11M 10428 S 0.0 1.1 0:00 0 kdeinit 11864 root 15 0 139M 11M 2908 S 0.5 1.1 1:07 0 X 11988 mythtv 15 0 14676 11M 10284 S 0.3 1.1 0:04 0 kdeinit 11967 mythtv 16 0 11704 11M 11348 S 0.0 1.1 0:00 0 kdeinit 11964 mythtv 16 0 10636 10M 10404 S 0.0 1.0 0:00 0 kdeinit 12025 mythtv 16 0 12796 9.8M 8684 S 0.0 0.9 0:00 0 kdeinit 11987 mythtv 16 0 12800 9.8M 8864 S 0.0 0.9 0:00 0 kdeinit 12112 root 16 0 14548 9424 7888 S 0.0 0.9 1:43 0 mythbackend 12038 mythtv 16 0 11444 8696 7232 S 0.0 0.8 0:00 0 kalarmd 11993 mythtv 16 0 9472 6600 6392 S 0.0 0.6 0:00 0 kdeinit 12028 mythtv 16 0 6592 6592 5668 S 0.0 0.6 0:00 0 eggcups 11961 mythtv 16 0 8460 5580 5432 S 0.0 0.5 0:00 0 kdeinit 13279 root 16 0 5048 5048 2060 R 0.0 0.4 0:00 0 xterm 4509 mysql 16 0 9108 4824 2752 S 0.0 0.4 0:13 0 mysqld 4462 ntp 16 0 3884 3884 2204 S 0.0 0.3 0:00 0 ntpd 12026 mythtv 16 0 3880 3880 3348 S 0.0 0.3 0:00 0 pam-panel-ico 12033 mythtv 16 0 3556 3556 1924 S 0.0 0.3 0:00 0 gconfd-2 12781 mythtv 15 0 1576 1576 788 S 0.0 0.1 0:00 0 tcsh 4636 xfs 16 0 3096 1516 520 S 0.0 0.1 0:01 0 xfs 12847 mythtv 16 0 1316 1316 732 S 0.0 0.1 0:00 0 tcsh 13281 root 16 0 1276 1276 708 S 0.0 0.1 0:00 0 tcsh 13215 root 16 0 1252 1252 708 S 0.0 0.1 0:00 0 tcsh 4699 root 16 0 4160 1204 796 S 0.0 0.1 0:00 0 miniserv.pl 11880 mythtv 18 0 1172 1172 828 S 0.0 0.1 0:00 0 tcsh 13305 root 16 0 1148 1148 900 R 0.1 0.1 0:00 0 top 4711 root 15 0 1268 1096 1092 S 0.0 0.1 0:00 0 gdm-binary 11928 mythtv 16 0 980 980 852 S 0.0 0.0 0:00 0 startkde 13212 root 17 0 968 968 808 S 0.0 0.0 0:00 0 su 4391 root 16 0 1260 948 864 S 0.0 0.0 0:00 0 cupsd 4650 root 16 0 1092 848 672 S 0.0 0.0 0:00 0 nmbd 4541 root 16 0 1272 728 580 S 0.0 0.0 0:00 0 sendmail 4137 root 16 0 888 724 620 S 0.0 0.0 0:00 0 dhclient 11929 mythtv 16 0 668 668 540 S 0.0 0.0 0:00 0 ssh-agent 4550 smmsp 15 0 1088 652 548 S 0.0 0.0 0:00 0 sendmail 4448 root 16 0 712 604 604 S 0.0 0.0 0:00 0 xinetd 4374 root 17 0 616 584 440 S 0.0 0.0 0:00 0 smartd Thanks Daniel |
Linux has a different view on the memory than windows.
Instead of trying to keep as much free memory as possible Linux tries to maximaze the usage of your expensive and speedy memory. Linux has a dynamic handling of buffers and cache meaning that if memory is available linux will increase the buffers so that next time that same info is needed from the hard disk it will be in memory instead. I can't say that I have got a full grip on the different memory allocations or exacly where to look for available memory size. My experince is that if the swap is being eaten up, not just a tiny bit, then the memory is getting crowdy. I have a 256MB on Suse roght now and that seems too small. |
ok so it sounds like the occasional hit on swap isn't a problem, only if I am ~constantly swapping do I need to add more memory? How does linux determine what to cache from the harddrive? In my case I'm viewing video which is constantly changing so the odds seem pretty low of me accessing the same data from the harddrive over and over again...doesn't seem like cache would buy much in my situation.
Thanks |
Recently read and written data is kept in memory till the memory is needed for other things.
Periodically data is written to drive, but the data is kept till memory is needed by other processes. |
All times are GMT -5. The time now is 08:42 PM. |