Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is it a bad thing when RAM and Swap both get completely used up? If so, is there a command or something to free it, without having to manually delete unneeded processes (or reboot)?
it's not a bad thing when your ram gets used - the kernel just caches a lot of stuff, and flushes the memory as it needs to (making restarting apps faster)
however, if your swap is full, then this is really bad. Your system has basically run out of memory......
The system will take the necessary action if you don't.
There is a task known as the oom (out of memory) killer.
It determines the best task to kill to allow the system to continue running. This may not be the task you would select, so don't allow it to come to this if at all possible.
Edit: Forgot to mention you can also add more swap space - i.e. you can have more than one. Generally needs to be done ahead of time.
I've been hit by that one before, and you are 100% correct; it doesn't usually choose to kill the process I would want to kill I doubled my RAM from 2GB+swap to 4GB+swap and the problem went away (though, I run biology simulations that eat up GOBs of RAM).
Out there in the MS-Windows-world there are many utilities doing so-called
'RAM defragmentation', a technique which function lies solely in the users
subjective measurement of performance. These tools CLAIM to rearrange the
structures in RAM so that access to portions of the memory will speed up -
what they really DO is showing a simple progress bar and some mindless
statistics afterwards.
As more and more Windows users change to Linux nowadays, the need for a
Linux tool having the same (purely snake-oil) functionality arises. This
project is planned to take care of the problem.
Code for this project will be written in good ol' C, and as it is a
GUI-tool it will at first use GTK+ for the interface, supported by GLADE -
but maybe later versions may use qt or something alike as well. The actual
supported platform is Linux, but it should be possible to port this to any
other platform having a possibility to display progress bars.
it's not a bad thing when your ram gets used - the kernel just caches a lot of stuff, and flushes the memory as it needs to (making restarting apps faster)
however, if your swap is full, then this is really bad. Your system has basically run out of memory......
how much ram do you have?
maybe you can post the output of "top"
I have 512MB of RAM and an equal amount of Swap(my understanding was that is was unadvisable to make swap larger than that for Slackware). I have never actually run out of swap, but it seems the possibility definitely exists. One reason I want to switch to Linux, is so I can keep my computer(s) turned on indefinitely, without having to reboot constantly (like I had to with Win9x). It just seems like if I ran my computer for just a few days, it would run out of Swap, and I was interested if there was a way to "flush" it (or RAM), so I don't have to reboot. Perhaps I misunderstand the technology, my understanding is that when RAM is full, it stays that way, and processes start getting sent to Swap, and when that is full you are SOL. Is that correct? Or is the kernel more dynamic than that? I ask because after just a few hours of using Linux, my RAM is full and swap starts getting used. Is that normal?
Last edited by blnkgcrsr001; 04-27-2006 at 06:38 PM.
Actually RAM should be fairly empty unless you're actually doing something with your computer. If you've ever paid for an operating system that doesn't collect things out of memory that aren't getting used I recommend demanding your money back. I suppose if you're running a web server with steadily increasing traffic you could see memory load increase the way you describe, but if it's just idling for a few hours then it shouldn't happen at all. Sounds to me like something is wrong.
Actually, Linux caches everything it can into RAM, so RAM is usually NEARLY full, even on a quiet system. It always leaves a bit free at any instance (see top).
However, swap should never fill up entirely, that would indicate a memory leak in a program.
I've never heard of RAM defrag and frankly I'd trust the kernel boys to handle that whole area better.
chrism01 is basically correct - blnkgcrsr001 try the following from a terminal
Code:
free > stats.log ; vmstat 1800 4 >> stats.log &
(including the trailing ampersand). This will run a background task to collect some stats - in this case every 30 mins for a couple of hours. The "jobs" command will show it running - when it no longer shows up, check the stats.log to see if it looks like a leak. Post it here for us to offer an opinion if you like.
chrism01 is basically correct - blnkgcrsr001 try the following from a terminal
Code:
free > stats.log ; vmstat 1800 4 >> stats.log &
(including the trailing ampersand). This will run a background task to collect some stats - in this case every 30 mins for a couple of hours. The "jobs" command will show it running - when it no longer shows up, check the stats.log to see if it looks like a leak. Post it here for us to offer an opinion if you like.
I tend to agree with that too. I'll give it a shot, and if it looks strange, I'll post it. Perhaps, my question is better asked this way: Is it possible to run a linux computer for several days or weeks without rebooting to free memory(doing normal user stuff like internet, email, watching movies, etc.)?
Is it possible to run a linux computer for several days or weeks without rebooting to free memory(doing normal user stuff like internet, email, watching movies, etc.)?
Absolutely. My desktop has been up for over 5 days now.
That's one of the things Linux is known for ie being able to do that. Remember people use it for servers that stay up for mths even yrs at a time.
If you're worried, perhaps you have some dodgy sw, but Linux itself should be fine.
Just check top regularly until you feel happy.
Don't forget a rogue prog could fill the non-swap part of your disk(s)... so run df regularly as well.
Astute observers who examine the Netcraft web site URL will note that all 50 servers in the Netcraft uptime list are running a form of BSD, mostly BSD/OS. None of them are running Windows, and none of them are running Linux. The longest uptime in the top 50 is 1,768 consecutive days, or almost 5 years.
OK, it's BSD instead of linux, but it gives an idea
Given the 497-rollover quirk, it is difficult to compare Linux uptimes vs. Windows uptimes from publicly available Netcraft data. Two data points are statistically insignificant, but they are somewhat telling, given that one of them concerns the Microsoft website. As of September 2004, the average uptime of the Windows web servers that run Microsoft's own web site (www.microsoft.com) is roughly 59 days. The maximum uptime for Windows Server 2003 at the same site is 111 days, and the minimum is 5 days. Compare this to www.linux.com (a sample site that runs on Linux), which has had both an average and maximum uptime of 348 days. Since the average uptime is exactly equal to the maximum uptime, either these servers reached 497 days of uptime and reset to zero 348 days ago, or these servers were first put on-line or rebooted 348 days ago.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.