check your memory usage

February 2nd, 2007 mysurface Posted in Common, free | Hits: 41449 | 3 Comments »

To check for the overall usage of memory including physical and swap memory, we can use a simple command – free.

You just need to type free and it will shows you the information of the memory usage. Lets, take mine as an example:


             total       used       free     shared    buffers     cached
Mem:        514576     509008       5568          0      59300      95188
-/+ buffers/cache:     354520     160056
Swap:       891568      35424     856144

The value shows at the first line of total column, is the total physical memory I have in kilobytes. i have 512M ram, the results (514,576kb) shown above is approximate in kb. So the system have already used almost all the physically memory, which just left about 5M as free memory.

Out of 354M from 509M that stored in the system, is actually used. And it still left 160M in cache. I have total 891M of swap which is almost double of the size of physical memory I have, and it uses 35M and remain 856M unused.

The memory usage seems high but still consider healthy. I have loaded a lots of applications and uses some minor disc space for swap, but everything still running smooth without any lags.

Free have few options, if you feel that memory result shows in kb is not detail enough, you can have more accurate measurement in bytes. You can passes -b for bytes, or less details -m for Megabytes, -g for gigabytes.

free -b

You can ask free to display results in every 5 seconds, in order to track the increases/decreases on memory usage.

free -s 5

Is it free useful?
Reduce your Linux memory footprint written by Martyn Honeyford. The author talks about how you can track the memory usage and he gives suggestions on how to reduce it to the minimum. The first part of the article uses free to do the magic!

3 Responses to “check your memory usage”

  1. When I use the top command , I see that httpd is occuring many times. Also I am able to see the CPU usage and Memory usage for each httpd pids.

    Can you let me know a way out to see the total memory usage by all the httpd processes.

    Thanks

  2. Thanks for sharing this. Saved a lot of time.

  3. I constantly spent my half an hour to read
    this web site’s articles everyday along with a mug of coffee.

Leave a Reply