0

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
1

2 Answers 2

2

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: https://stackoverflow.com/questions/8066252/invalid-argument-error-for-sysctl-vm-drop-caches-key-in-ubuntu-11-10-kernel-3

5
  • 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, 2012 at 15:23
  • try -> sync; echo 3 > /proc/sys/vm/drop_caches source: commandlinefu.com/commands/view/1026/… Jul 27, 2012 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, 2012 at 15:32
  • pastie the output of $ ps aux | sort -b -k 4 | tail Jul 27, 2012 at 15:47
  • Please see the output in the main question.
    – Sander
    Jul 28, 2012 at 16:17
0

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

1
  • 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, 2012 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .