Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I havea poor mans vps - 256MB dedicated RAM. I have installed LAMP. No website is currently UP on the server yet.

The memory usage is still 225MB (only 31 MB free).

I have measured using top and another method. Top says around 225mb used, but if I sum up the processes, it comes to be only 20%.

Another script I am using to measure the memory:

bean=`cat /proc/user_beancounters`
guar=`echo "$bean" | grep vmguar | awk '{ print $4;}'`
priv=`echo "$bean" | grep privvm | awk '{ print $2;}'`
let totl=guar/256
let used=priv/256
let free=$totl-$used
echo "VPS Memory:"
echo "  total: $totl mb   used: $used mb   free: $free mb"

gives same result (225MB used).

I have rebooted the server, but still 225MB memory is being used. How can I find the culprit process. please help!


Output of ps efax -o command,vsize,rss,%mem,size indicates that only 20% (aournd 50MB) is actually used by processes.

(apt-get install imagemagick is failing because of low RAM. I guess I need to go for higher memory like 512 MB. I thought the failure might be due to this "spurious" memory usage).

Is there any way to know if the memory is indeed available as cache (top shows buffer/cach as 0 - I heard that if the RAM was available as cache, it would appear as "bufffers or cache).

Output of free -m:

free -m
             total       used       free     shared    buffers     cached
Mem:           256        226         29          0          0          0
-/+ buffers/cache:        226         29
Swap:            0          0          0

Its showing free buffers/cache also as on 29 MB :(

share|improve this question
what does free -l tell you? – The Unix Janitor Oct 14 '10 at 8:54
xyz@pqr:~$ free -l total used free shared buffers cached Mem: 262144 232056 30088 0 0 0 Low: 262144 232056 30088 High: 0 0 0 -/+ buffers/cache: 232056 30088 Swap: 0 0 0 – JP19 Oct 14 '10 at 13:54

Linux will use as much ram as it can as cache which will be given up if other processes require more memory. Have a look here for some more information.

share|improve this answer
That site says it better than I ever could have. Thanks for posting it. – Cakemox Oct 14 '10 at 9:22
Is there any way to know if the memory is indeed available as cache (top shows buffer/cach as 0 - I heard that if the RAM was available as cache, it would appear as bufffers or cache). – JP19 Oct 14 '10 at 14:01
As I added in the question, "free -m" shows that even buffer/cache free memory is 29 MB. According to, if RAM was really available, it would show as free in the buffer/cache line. Am I missing something? – JP19 Oct 14 '10 at 14:06

try using from following link how is use by which process and update back

share|improve this answer

Try these commands

top -n 1


ps efax -o command,vsize,rss,%mem,size

The answers to this question on also can be of help "How can I display the memory usage of each process if I do a ps ef"

share|improve this answer
Its giving a list of about 20 processes (cant add as comment due to msg limit). However, the sum of the memory usage is around 20% (same with output of top). I am now thinking that it is indeed that linux is using the ram as "cache". – JP19 Oct 14 '10 at 13:56
up vote 0 down vote accepted

Guys, thanks to all for responding. Turned out mysql was using 139MB of "virtual memory". As my VPS does not have SWAP enabled, virtual memory was being taken from the RAM.

(And TOP doesnt display virtual memory in the % usage column -so missed it completely!).

Did two good things to reduce the memory requirement :

1) skipd-innodb in /etc/mysql/my.cnf 2) systemwise ulimit of 256 in /etc/rc

(it was unlimited earlier on causing huge memory footprint).

cheers, JP

share|improve this answer

Your Answer


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