Jun 2

when I run the free command on my laptop, I get data similar to this.

total used free shared buffers cached
4050260 3988204 62056 0 71160 3551948

That breaks down to
4050260 kb of memory that is usable for programs. This is the amount of system memory that is installed, minus the amount of RAM that is being used for the Kernel, drivers and video card shared memory.

3988294 kb of memory in use. Note that it isn’t saying what the specific use is for, whether it’s programs using it or whether it’s stale. It’s just in use.

62056 kb of memory free. yeah, that’s just A – B = C.

71160 kb of memory in buffers. This is a bit generic, but is the amount of memory that is being used for disk buffers, network buffers, etc. Anything that requires or benefits from having a place to buffer data gets stored here.

3551948 kb of memory cached. This is what’s using up all of your memory and for good reason. Every time a program does a read(), that data gets dumped into cache where it sits until something else bumps it out. This is a good thing because it keeps the OS from having to hit the disk to recall data that it just accessed a few minutes ago. Linux very, very quickly fills up all of the RAM that it can due to this behavior, but the good news is that this memory is essentially sitting free. It takes just as much time to overwrite a memory block with a 0 as it does to write it with a 1, so think of this as a scraps bin where you put cutoffs in case you should ever need them.

If you really want to see where your memory is going, cat /proc/meminfo. A lot of the numbers should look familiar, but a quick look at “Active:” will tell you how much of that memory is in a state where it can be considered untouchable.

Next Entries »