Friday, February 19, 2010

Understanding memory usage from top and htop

Actually from htop and top utilities, you can find how the memory is used and buffered.

When you run top, you will notice that a lot of memory are being used even though there may not be much applications currently running. The reasons for this huge usage is that the kernel allocates memory that isn't in active use by processes to things like filesystem caches to improve performance. If there is demand on the memory by another application or data, the kernel will free up the memory.

If you run top,  you will notice buffers and cached. "Buffers" represent how much portion of RAM is dedicated to cache disk block. "Cached" is similar like "Buffers", only this time it caches pages from file reading.

However if you run htop, the memory used is smaller. Both utilities are not wrong, it is a different representation of the memory usage

For more information, you may want to read an excellent article on Using Top More Efficiently 

No comments: