LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   RAM used by process (https://www.linuxquestions.org/questions/linux-newbie-8/ram-used-by-process-685014/)

landysaccount 11-20-2008 06:58 PM

RAM used by process
 
Good evening.

I would like to know how much memory a process is utilizing. I have a system with 1G RAM when it boots up and all the processes or daemons or applications are running free -m tells me that there is aprox. 500M free. But, after a couple of days continuously running it drops down to about 8M. How do I find out which program is eating all that memory? I run top but can't really tell how much exactly each process is consuming. I know squid uses a lot of memory but, damn!


top - 20:56:21 up 3 days, 3:28, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 42 total, 2 running, 40 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 906792k total, 897712k used, 9080k free, 27104k buffers
Swap: 979924k total, 44k used, 979880k free, 786492k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7115 proxy 15 0 36048 31m 2276 S 0.0 3.6 0:07.77 squid3
1995 root 18 0 17184 5884 3448 S 0.0 0.6 0:00.01 apache2
2011 www-data 15 0 17316 4700 2184 S 0.0 0.5 0:00.00 apache2
2475 www-data 15 0 17316 4668 2160 S 0.0 0.5 0:00.00 apache2
5289 www-data 15 0 17316 4668 2160 S 0.0 0.5 0:00.00 apache2
2012 www-data 15 0 17316 4664 2156 S 0.0 0.5 0:00.00 apache2
2013 www-data 15 0 17316 4664 2156 S 0.0 0.5 0:00.00 apache2
2015 www-data 15 0 17316 4660 2156 S 0.0 0.5 0:00.00 apache2
6183 www-data 15 0 17316 4656 2152 S 0.0 0.5 0:00.01 apache2
2014 www-data 18 0 17316 4640 2140 S 0.0 0.5 0:00.00 apache2
7127 root 15 0 7864 2396 1920 R 0.0 0.3 0:00.07 sshd
7129 root 15 0 4008 1724 1320 S 0.0 0.2 0:00.16 bash
1962 root 15 0 5900 1408 556 S 0.0 0.2 0:00.00 squid3
1949 ntp 15 0 4128 1328 1020 S 0.0 0.1 0:00.12 ntpd
7182 root 15 0 2232 1112 860 R 0.0 0.1 0:00.00 top
1934 root 15 0 4932 1096 756 S 0.0 0.1 0:00.14 sshd
7116 proxy 18 0 2824 924 784 S 0.0 0.1 0:00.03 unlinkd
1979 root 18 0 2196 872 684 S 0.0 0.1 0:00.04 cron
1 root 15 0 1944 648 552 S 0.0 0.1 0:00.83 init
1893 root 18 0 1624 636 512 S 0.0 0.1 0:00.29 syslogd
1076 root 20 -4 2180 596 340 S 0.0 0.1 0:00.08 udevd
1913 root 18 0 1752 576 480 S 0.0 0.1 0:00.00 inetd
2168 root 18 0 1576 496 424 S 0.0 0.1 0:00.00 getty
2169 root 18 0 1576 496 424 S 0.0 0.1 0:00.00 getty
2175 root 18 0 1576 496 424 S 0.0 0.1 0:00.00 getty
2167 root 15 0 1572 492 424 S 0.0 0.1 0:00.00 getty
2176 root 18 0 1572 492 424 S 0.0 0.1 0:00.00 getty
2170 root 18 0 1572 488 424 S 0.0 0.1 0:00.00 getty
1899 root 15 0 1576 380 308 S 0.0 0.0 0:00.00 klogd
2 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
3 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0
4 root 16 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
5 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
8 root 20 -5 0 0 0 S 0.0 0.0 0:00.03 kblockd/0
25 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kseriod
92 root 25 0 0 0 0 S 0.0 0.0 0:00.00 pdflush
93 root 15 0 0 0 0 S 0.0 0.0 0:00.24 pdflush
94 root 17 -5 0 0 0 S 0.0 0.0 0:03.12 kswapd0
95 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 aio/0
536 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khubd
1404 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kpsmoused
1643 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kmirrord

syg00 11-20-2008 07:07 PM

Seems you're not understanding what you're reading. Have a look at this thread, and re-post if you still have questions.

Edit: link in the referenced thread has a bad link - seems the gentoo wiki has been lost. Here is a copy of the article.

landysaccount 11-20-2008 07:25 PM

Thank you for your quick reply.

After reading that post I have a better understanding of how programs utilize RAM. Thank you for clarifying.

After running that script of yours I get: Memory usage: 93 of 885 MegaBytes

Thank you again.

korexmohan 11-27-2008 06:51 AM

Squid performance slow down after blocking sites
 
Hi pals,
To block the porn sites downloaded the list of porn sites from net and linked the file to my squid.conf for blocking thru acl. After making this change my system works fine for 20 mins after that the mem usage become 904MB out of availabel 1 GB and the system become very slow. I am even not able to type something in terminal window.
When i remove this line from squid.conf it works fine again.
Please help...Any changes need to be done in Squid.conf???
The blocked site file size is 6MB and contains some 1,71,252 sites listed in this file.


All times are GMT -5. The time now is 04:46 PM.