Understanding memory usage on Linux

  • February 4, 2007
  • Avatar for peter
    Peter
    Upfold

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

Home » Articles »