Understanding memory usage on Linux

If you've ever run the free command on Linux to see how much of your RAM is free, you might have been quite alarmed at the amount of memory listed as free. You can use the free command from the terminal to show your memory usage (the -m switch shows the output in megabytes):

$ free -m

For example, here's the output on my system (values shown are megabytes):

Output of free -m

As you can see, I've got 1 GB of RAM, and if you look at the first line, 992 MB of that are apparently used! Well, yes, and no.

IBM's DeveloperWorks has an interesting article about memory and the Linux kernel:

The first line indicates that, out of 256MB of RAM, 231MB is "in use." The next line shows us that while 231MB is being used, only 86MB of this is actually being used by applications; the rest is being used for buffers and cache.

So if we take a look at the line below, in reality only 388 MB are being used, which sounds more reasonable (for reference, I've got an email client, two browsers with lots of tabs and a command line window open with two sessions running, including software updates. Whew!).

So if you ever feel like panicking about how much memory your Linux system appears to be using, stop and check the second line of free.

[via]

Avatar for peter Peter Upfold - http://peter.upfold.org.uk/

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Understanding memory usage on Linux

  1. Lee (guest)

    # Posted on 04 February 2007 at 08:41 AM

    That's interesting, I'd never actually known how to figure out how much ram was being used before, seems like I'm using just 120Mb and 0Mb swap, with Ubuntu and nothing else open. Nice and low, with plenty to spare :)



Home » Articles » Understanding memory usage on Linux