Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My VPS is using much RAM. To identify the problem I stopped literally every service, the VPS is still using 4.5GB of RAM. The VPS is running on XEN, so the RAM is not shared.

This is the output of free -m after stopping all services (except ssh):

[root@node3 ~]# free -m

             total used free shared buffers cached

Mem:          6928 5510 1417 0 130 704

-/+ buffers/cache: 4676 2251

Swap:         3071 106 2965

Could someone help me with this? Many thanks.

[root@node3 custombuild]# ps aux | sort -b -k 4 | tail
acusu161  307520  0.0  0.0  94344  1828 ?        SN   14:42   0:00 sshd: acusu161@pts/2
root      301805  0.0  0.0  94344  3352 ?        SNs  14:19   0:00 sshd: acusu161 [priv]
root      307459  0.0  0.0  94344  3360 ?        SNs  14:41   0:00 sshd: acusu161 [priv]
acusu161  301833  0.0  0.0  94484  1896 ?        SN   14:19   0:00 sshd: acusu161@pts/1
acusu161  328664  0.0  0.0  95128  1748 ?        SN   16:24   0:00 sshd: acusu161@pts/4
root      328660  0.0  0.0  95128  3348 ?        SNs  16:24   0:00 sshd: acusu161 [priv]
named      10398  0.0  0.1 589860  7896 ?        Ssl  Jul23   0:02 named -u named
root      340628  0.0  0.3 127764 26884 ?        SNs  16:48   0:01 lfd - sleeping
root        6508  0.0  0.4  38936 32788 ?        S<Lsl Jul23   0:00 iscsiuio
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
share|improve this question
    
I'll just leave this right here...linuxatemyram.com –  MDMarra Jul 27 '12 at 17:01
add comment

2 Answers

It's nothing to worry about, linux likes to cache things, the cache will be overwritten when new processes ask for the memory.

You can clear it. ymmv.

   sudo sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=0 

source: http://duopetalflower.blogspot.ca/2009/09/clearing-cache-memory-in-linux-using.html

   free && sync && echo 3 > /proc/sys/vm/drop_caches && free

source: http://www.commandlinefu.com/commands/view/1026/empty-the-linux-buffer-cache

To free pagecache:
        echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
        echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
        echo 3 > /proc/sys/vm/drop_caches

source: http://stackoverflow.com/questions/8066252/invalid-argument-error-for-sysctl-vm-drop-caches-key-in-ubuntu-11-10-kernel-3

share|improve this answer
    
I just ran that command. However as you can see in the free -m output below, it's using 4987MB without caches. total used free shared buffers cached Mem: 6928 5015 1913 0 1 26 -/+ buffers/cache: 4987 1940 Swap: 3071 115 2956 –  Sander Jul 27 '12 at 15:23
    
try -> sync; echo 3 > /proc/sys/vm/drop_caches source: commandlinefu.com/commands/view/1026/… –  foocorpluser Jul 27 '12 at 15:26
    
This did not work as well: [root@node3 custombuild]# sync; echo 3 > /proc/sys/vm/drop_caches [root@node3 custombuild]# free -m total used free shared buffers cached Mem: 6928 5075 1852 0 1 28 -/+ buffers/cache: **5046** 1881 Swap: 3071 115 2956 –  Sander Jul 27 '12 at 15:32
    
pastie the output of $ ps aux | sort -b -k 4 | tail –  foocorpluser Jul 27 '12 at 15:47
    
Please see the output in the main question. –  Sander Jul 28 '12 at 16:17
add comment

Try installing an utility such as "htop" and sorting (F6) by memory usage (MEM%) to see which processes are using how much memory.

share|improve this answer
    
I just installed htop and checked. However, the outcome is the same as with top, when all main services are stopped there is not a service using more then 0.4% RAM while the RAM usage is about 4,5GB. –  Sander Jul 27 '12 at 15:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.