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.

I have a VPS with directadmin installed on.
The amount of memory I bought from my VPS provider is 1GB and in the system it it shows that I have 1GB of memory available.
From the beginning I regularly checked the memory usage of the system, and it never came below 600MB. I thought it's ok until recently. I suspect something must be wrong, because my memory usage now is above 850MB.

I used the top and ps aux commands and got the list of running processes on the system. after doing the math I got that the memory usage of apache and mysql summed up should not be much above 500MB.
I then did something else: I deactivated the apache and mysql and again saw that the used memory is stuck around 600MB.

What I want to know here is, am I doing it wrong (calculating memory)? Or is my provider lying about the amount of memory they gave me? Is it even possible, or there's a hidden process eating up the system memory?

share|improve this question
    
Checked memory usage using what command? –  Paul Aug 1 '11 at 9:24
    
@Paul free -t -m –  Hamed Momeni Aug 1 '11 at 9:26
3  
Please read linuxatemyram.com If that doesn't answer your question, please post the output of the free command here. –  SvW Aug 1 '11 at 9:28
2  
I'm pretty confident you're doing it wrong. –  womble Aug 1 '11 at 9:29
    
@SvenW well that's a relief! I would've picked your answer as the best if it wasn't a comment! ;) –  Hamed Momeni Aug 1 '11 at 9:35

2 Answers 2

up vote 7 down vote accepted

You have earned Confused by Linux memory usage badge!

Processes are not the only thing eating up memory in Linux. The frequently used files and directory entries are cached in RAM - that's because reading the files from RAM is lots faster than reading them from disk. I bet you didn't take buffers and cached columns into account while calculating the RAM usage. Those can be calculated as free RAM, too.

But don't you worry. Those caches and buffers automatically get flushed in no time if your applications actually need that RAM.

share|improve this answer
    
yup, I got it. you're right. :) thanks. –  Hamed Momeni Aug 1 '11 at 9:36

You are probably being confused by memory caching, see http://www.linuxatemyram.com/.

There is a python script available at http://www.pixelbeat.org/scripts/ps_mem.py that will give you a slightly more accurate view of global and per-app memory usage.

share|improve this answer
    
thanks, it was a good script. –  Hamed Momeni Aug 1 '11 at 9:50

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.