New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Memory usage not clear
below the result of "top" :
Mem: 262144k total, 45456k used, 216688k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 15 0 2824 1376 1220 S 0.0 0.5 0:00.50 init
1142 root 14 -4 2304 624 436 S 0.0 0.2 0:00.00 udevd
1365 root 25 0 35548 1240 944 S 0.0 0.5 0:00.00 rsyslogd
1383 root 18 0 8240 1092 684 S 0.0 0.4 0:00.00 sshd
1390 root 25 0 3116 888 716 S 0.0 0.3 0:00.00 xinetd
1397 root 18 0 6744 780 472 S 0.0 0.3 0:00.00 saslauthd
1398 root 18 0 6744 488 180 S 0.0 0.2 0:00.00 saslauthd
1405 root 18 0 6984 1164 624 S 0.0 0.4 0:00.00 crond
1419 root 15 0 11112 3256 2664 S 0.0 1.2 0:00.06 sshd
1422 root 15 0 6224 1648 1404 S 0.0 0.6 0:00.01 bash
1447 root 15 0 2520 1040 868 R 0.0 0.4 0:00.00 top
45M of RAM used but sum of %MEM of all process is 4%.
4% of 256M Memory total is not 45M.
Where my memory is used?
OS: CentOS 6
VPS: 128M / 256M
thanks a lot.

Comments
Hi
Use free -m
# free -m total used free shared buffers cached Mem: 4031 192 3839 0 3 49 -/+ buffers/cache: 138 3893 Swap: 1023 0 1023In my example I am using 138 MB.
If you want to know the memory used but every process, then is another story. Mmm, in a KVM/Xen/physical platform, generally I take the RES column, but I am not sure.
In openVZ this isn't valid, the processes use more RAM than RES shows.
use command "ps v" to see which app takes what exaclty
to save some memory: apt-get --purge remove syslog-ng rsyslog udev cron
also change ssh to dropbear
ps_mem
I think most of that occurs with the lowendscript:
http://www.lowendbox.com/blog/wordpress-cheap-vps-lowendscript/
This is my free -m ( @yomero )
Results of ps_mem (see @circus comment)
Top command is above in my first post.
4.7M are used by programm where are the rest of used memory?
@drmike: at this time I don't want optimize my memory usage I want know where my memory is used.
Thanks.
@drmike, no I meant lowendscript is purging the bits that @kristal suggests up there.
is this a 64bit system?
is this xen or open?
@collaborando
Well, because that you are in an OpenVZ VPS, the ps_mem isn't accurate, as I said, openVZ manages the memory in a different way. How? I am not sure, but look at the VIRT columns in top (htop is better
), in some processes is a better way to measure the RAM consumption in OpenVZ.
Don't use rsyslog, it wastes too much ram on a OpenVZ VPS.
Really? I don't use it too, but I don't see any significant gain. How much is "too much ram"? Less than 1-2MB IMO
on an open vz, usually 96 or 128, everything is too much :P must be strict with ram control :->
just to use resouces in the most efficient way that is :P
install debian 5 :->
[root@lion ~]# free -m total used free shared buffers cached Mem: 256 55 200 0 0 0 -/+ buffers/cache: 55 200 Swap: 0 0 0 [root@lion ~]# service rsyslog stop Shutting down system logger: [ OK ] [root@lion ~]# free -m total used free shared buffers cached Mem: 256 24 231 0 0 0 -/+ buffers/cache: 24 231 Swap: 0 0 031mb for a syslog daemon is too much.
The best way I have found for knowing how much ram something uses on a openvz vps is to run free -m, stop it, then run free -m again due to openvz's allocation (not usage) based memory limits
On my KVM VPS, ps_mem reports more ram used than free -m:
ps_mem.py Private + Shared = RAM used Program 80.0 KiB + 22.5 KiB = 102.5 KiB klogd 128.0 KiB + 34.5 KiB = 162.5 KiB syslogd 140.0 KiB + 32.0 KiB = 172.0 KiB acpid 112.0 KiB + 72.0 KiB = 184.0 KiB mingetty (2) 132.0 KiB + 63.5 KiB = 195.5 KiB init 284.0 KiB + 31.5 KiB = 315.5 KiB udevd 296.0 KiB + 158.0 KiB = 454.0 KiB dropbear (2) 196.0 KiB + 284.5 KiB = 480.5 KiB mysqld_safe 592.0 KiB + 52.0 KiB = 644.0 KiB crond 396.0 KiB + 288.5 KiB = 684.5 KiB bash 736.0 KiB + 86.5 KiB = 822.5 KiB exim 648.0 KiB + 271.5 KiB = 919.5 KiB nsd (3) 2.7 MiB + 98.0 KiB = 2.8 MiB python26 14.9 MiB + 1.7 MiB = 16.6 MiB nginx (2) 8.4 MiB + 8.9 MiB = 17.3 MiB php-fpm (3) 18.3 MiB + 252.0 KiB = 18.5 MiB mysqld --------------------------------- 60.3 MiB ================================= Private + Shared = RAM used Program [root@tiger ~]# free -m total used free shared buffers cached Mem: 122 116 5 0 9 57 -/+ buffers/cache: 50 72 Swap: 258 0 258WTF, my rsyslog doesn't use so much. Or it has memory leaks? Because at the start it uses like 2-3MB ram
On a OpenVZ VPS?
@dmmcintyre3 thank you for suggest
afeter service rsyslog stop
rsyslog takes 25M on my OpenVZ VPs with CentOS6.
I found this about optimizing difference between VIRT and RES memory on OpenVZ:
http://www.lowendbox.com/blog/reduce-stack-limit-for-multi-thread-apps/
@yomero thank you.
Yeah, that post is useful too
Are there any noticeable downsides in reducing stack limit?
Some software can crash, but, that happens with extreme settings like...
ulimit -s 32or sth ike that