The Linux Newbie

A Linux Newbie Helping Others Come Into The Linux World.

Have any TUTORIALS or HOWTOS you would like to post online?

Friday, August 11, 2006

"Linux Uses Too Much Memory!" A (very) Basic Linux Memory Guide

When I first installed Kubuntu, I started right-clicking on everything... I especially wanted to know how to get all the cool apps on my taskbar that I had seen in other screenshots. Upon right-clicking on my taskbar I noticed something that said "Add Applet to Panel..." That sounded real promising, so I clicked and, alas, there appeared before my eyes a virtual cornucopia of little applets for me to add and remove, WOOHOO! And, since I love watching what my system is doing, I naturally picked "System Guard" for my very first app to add.

I ooo'd and aaaawe'd as I saw the pretty graphs stream across the bottom of my screen. However, one thing I noticed, and it seemed a little disconcerting to me, was the maxed-out colors on my memory graph. It seemed that all my memory was all used up, and as I moused over the graph it did not show the memory usage numbers. I felt I was at a dead end. Moreover, I was pretty sure, from all appearances, that KDE truly was a memory hog. But I had a lead; there were these mysterious words from my "mouse-over" that I wanted to understand, so I went about seeing what I could learn.

When I moused over the memory read-out, this is what I saw:

I had no idea what these lines meant, so I Googled around seeing what I could learn, and found a few interesting articles. One that explained the Linux memory process very simply to me (the first part anyways) was in the Gentoo Forums (Gentoo is a Linux Distribution). Basically, here is the deal.

Your computer is using all of your memory to optimize the performance of Linux. It caches or stores pieces of applications on your memory so that when you need them, it will not have to hunt around the hard drive to find the application. Now IF you bring up a program, and your memory is "full" Linux automatically kicks some of the cache out to make room. It is a fast-as-lightening operation that does nothing but make Linux optimized and faster.

As it turns out, the biggest amount of color on my bar graph was the cache (yellow). There was a small "thread" of red that was my buffer, and finally the blue section at the bottom was what my applications were actually using. Whew, I'm relieved now.

Windows has a similar "Prefetch" operation. However, it seems to me that Linux is more efficient at "unused memory" usage, since it uses all the memory. Also, once something is prefetched in Windows it's there, if you want your memory back, "Restart" is your only solution. That's why it's really good to reboot your Windows box every few days (if not everyday).

In the end I learned a nice, simple command that would give me all the info I ever needed, to know what my memory was up to.
The command:
free -m
Just bring up your terminal (Konsole in KDE) and type in the afore mentioned command, and you will get lots of fun stats on your memory.

Look on the "-/+ buffers/cache:" line and you will see what you are used to seeing in Windows: the application memory. The application memory is the total memory being used by your operating system and applications combined. I have found that on startup, I am using far less (almost half) memory in Linux than I ever did in normal operating conditions in Windows.

This is only a basic overview of Linux memory. Hopefully it helps anyone new to Linux get an initial grasp of the new operating system they have decided to undertake.

Helpful links:
KDE Applications
Gentoo Linux Forums
Kubuntu Forums

Digg It!Digg It!

Links to this post:

Create a Link

<< Home