LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   When SWAP and RAM are out (http://www.linuxquestions.org/questions/linux-general-1/when-swap-and-ram-are-out-399947/)

syberdave 01-05-2006 03:45 PM

When SWAP and RAM are out
 
Hello,

Sometimes, I accidentally run out of available RAM and swap space. When that happens, the system starts swapping VERY heavily and makes me unable to kill some processes.

I remember that on 2.4 kernels, it will automatically kill processes when it cannot allocate more RAM.

How would I set it so that the 2.6 kernel would kill processes instead of freezing up?

Thanks.

foo_bar_foo 01-05-2006 11:28 PM

just make a swap file for extra swap space

Gunark 01-06-2006 05:31 PM

Is there some sort of daemon or utility out there that could monitor your free RAM and warn you / freeze processes when you're almost out? I've accidently ran out a few times while in KDE (see my thread about X taking 460+ megs of RAM :mad:), and it gets pretty ugly. Often I can't even kill X with Ctrl+Alt+Backspace. It'd be nice if I had something that would watch my remaining free memory and stop whatever is eating it before it's too late.

syberdave 01-06-2006 10:09 PM

Quote:

Originally Posted by Gunark
Is there some sort of daemon or utility out there that could monitor your free RAM and warn you / freeze processes when you're almost out? I've accidently ran out a few times while in KDE (see my thread about X taking 460+ megs of RAM :mad:), and it gets pretty ugly. Often I can't even kill X with Ctrl+Alt+Backspace. It'd be nice if I had something that would watch my remaining free memory and stop whatever is eating it before it's too late.

Gkrellm can monitor memory usage and alert you when you're getting close. It can also run a command, so you can write a script to kill processes.

I usually have enough RAM and swap, but sometimes, I accidentally go over the limit. For example, this flash movie tried to load a whole video into memory.

I guess there's no easy way of preventing something like this from happening, except a huge swap partition/file.

J.W. 01-06-2006 10:44 PM

Out of curiousity, how much RAM and how much swap are you running?

syberdave 01-06-2006 11:58 PM

Quote:

Originally Posted by J.W.
Out of curiousity, how much RAM and how much swap are you running?

Code:

synide:~# free
            total      used      free    shared    buffers    cached
Mem:        255136    252812      2324          0      17712      40492
-/+ buffers/cache:    194608      60528
Swap:      259544    243644      15900

256MB of RAM and ~253MB of swap.

alienDog 01-07-2006 12:13 AM

Quote:

Originally Posted by Gunark
Is there some sort of daemon or utility out there that could monitor your free RAM and warn you / freeze processes when you're almost out?

There is ulimit command, see ulimit -a for current settings. It also gives you switches with which you can set the limits. You have to do it from the login shell. It doesn't warn you or anything, but it prevents the system from freezing and is really "the linux way" of doing this. Personally I don't like gkrellm, it just seems like a geek toy to me.


All times are GMT -5. The time now is 12:30 PM.