PDA

View Full Version : Memory Usage in Debian GNU/Linux


Modred
01-18-2006, 8:20 AM
As of late, I've been having more and more problems with my Debian install. Back before Christmas, a few blocks on the hard drive were corrupted and the system wouldn't boot, but I went through the process of fixing it and everything appeared fine. At this point I was running KDE on Debian 3.1 (sarge) with a 2.6.8 kernel. After getting the system to boot, I used aptitude to upgrade a large number of packages, which also apparently reinstalled KDE for some reason. But the system worked, so I had no problems.

At this time, my computer had only 256 Mb of RAM, so when the system filled up my memory usage to around 90% I didn't think much of it, X and KDE can be memory intensive, much moreso than a command line. But for Christmas I got a stick of 512 Mb RAM, and afterwards I noticed that if left alone for a few hours, the memory usage would soar up to around 97% of my physical memory. That's over 600 Mb of RAM doing nothing, at least that I can tell. X was using about 40 Mb, and KDE was using maybe 150 total between all of it's various processes. Throw in the other processes running on the system, and it shouldn't be anywhere near 600 Mb.

So I thought it might be KDE, and I was considering switching back to GNOME anyway, so I took the opportunity to do so. Apparently, KDE was not the problem, as I left my computer alone for a few hours while running GNOME (all other factors the same) and upon return, system resources showed upper reaches of 90% memory usage.

Which brings me to last night, when I was playing around with some command line stuff in a terminal, and then thought it might be interesting to leave the system monitor open while I slept so I could see how long it took for what looked like a memory leak to occur. So I leave the system monitor running and lock the screen. Five and a half hours later, I attempt to wake the computer and my monitor yells at me that it can't support the video mode, which it reports has a refresh rate of about 530 Hz. (As a note, my default resolution is 1280x1024 at 75 Hz.)

Unable to get the screen to return for me to log in, I killed the machine with the power switch, and now I'm back in Windows and looking to find out what happened.

First: is there any way to get around a bad resolution / refresh rate without turning the computer off?

Second: what could possibly be using that much memory, and could that be related to the monitor problem?

Last semester, I would leave my computer booted into Debian for weeks and have no such problems. I'm really not sure what's going on.

TimP
01-18-2006, 3:18 PM
The Linux kernel will swap files into unused memory if it's available. RAM access speed is immensely faster than hard drive access, so there's a very large performance boost. In one particular instance, I ended up installing a program off a CD and wiping it several times. After the first install, the CD had actually been mostly cached and install times dropped significantly. There's a way to find out how much of the system's RAM is actually being used by the kernel and applications and how much is being used for caching. phpSysInfo will show it, so if it can find out there's a way to do it from the command line. A quick check on my server with 320MB of RAM shows 92.36MB being used for kernel and applications, 64.39MB being used for buffers, and 135.71MB being used for caching. It's nothing to be alarmed about because if the system needs more RAM it will take it. On all the systems I run I typically have enough RAM so no caching ever occurs, even on my system with 320MB RAM.

A more extreme example would be the server I have with 2GB of RAM. Currently 277.02MB are being used for kernel and applications, 116.44MB is used for buffers, and 1.50GB is being used for caching.

If your systems video in X drops out, you could try going into console mode. Usually Alt-F1 through Alt-F4 will get you to a console, but it varies by distro. From there you can shutdown X and fix any problems.

Modred
01-18-2006, 4:10 PM
It's nothing to be alarmed about because if the system needs more RAM it will take it.
Alright, that's good.

If your systems video in X drops out, you could try going into console mode. Usually Alt-F1 through Alt-F4 will get you to a console, but it varies by distro. From there you can shutdown X and fix any problems.
And thanks very much. I've had similar problems before (like when I was first installing Debian and trying to manually configure X) and getting to a console would be very good at times like that.

Modred
01-18-2006, 8:15 PM
Apparently my hard disk is having some problems again, perhaps as a result of when I killed the computer due to the monitor problem. Anyway, I forced fsck to run on reboot, and it failed, so I ran it manually and fixed all the errors and then forced fsck on the next reboot. The final reboot gave me no error messages, so should that be the end of the hard drive problems? (at least in the short term)

TimP
01-18-2006, 8:27 PM
It should be fine, but in the near future I would start looking for a new drive, especially if you've had problems before. If it's not a critical computer you could always buy one on eBay. I bought a 6.5GB Maxtor drive for around $5 with shipping over the summer for an older Pentium III I use occasionally. If it serves a legitimate purpose either as a workstation or server you'd probably be better off buying a new drive off Newegg or similar sites.

pixels
01-18-2006, 9:01 PM
yeah RAM that isnt being used is wasted :P

i did the same thing when i booted up on a unix system. 'wheres all my ram!?' but its just cache.