You are not logged in.
My computer sometimes freezes for long periods of time. I believe it is due to Linux running out of RAM. When last I waited the freezing out, it took 30min+ for the OOM killer to kick in and do its job, it killed Firefox (which is probably a good choice, since it eats quite some RAM). Probably unrelated to the problem, journald crashed a few times during the low memory condition. The system load quickly increases while I can still issue a few commands in the remaining seconds when I can hopefully still open a console and execute a killall firefox. Last time the system woke up after that it had a 15min load of >20 (for 2 cores). The tool glances also tells me that the IO wait rises to astronomical levels (>80%) when this OOM stuff happens.
Running the following C program does exhibit a smaller variant of the problem, but the computer only freezes for a few seconds until the OOM killer kills the program:
#include <stdlib.h>
int main(int argc, char **argv)
{
while(1)
{
malloc(1);
}
}
My system has 4GB of RAM and no swap. This problem has existed on basically all devices that I ever ran Arch Linux on. Some sources suggest enabling swap, but this doesn't seem to solve the problem. Today I googled again and found the following, which does not help either: Ask Ubuntu: Computer freezing on almost full RAM, possibly disk cache problem.
Any ideas?
Offline
overcommit_accounting
On my system with the default x64 kernel
$ sysctl vm.overcommit_memory
vm.overcommit_memory = 0
Now if I understand the link correctly setting that to 2 stops overcommit so firefox for instance would gets its allocations failed sooner.
Hope this helps.
--
Edit Spelling
Last edited by loqs (2015-09-27 22:33:27)
Offline
overcommit_accounting
On my system with the default x64 kernel$ sysctl vm.overcommit_memory vm.overcommit_memory = 0
Now if I understand the link correctly setting that to 2 stops overcommit so firefox for instance would gets its allocations failed sooner.
Hope this helps.
--
Edit Spelling
I also have `vm.overcommit_memory = 0`. When I set it to 2, the computer did indeed not slow down when the RAM was getting full, but the OOM killer wasn't invoked either – leading to very weird behaviour of programs. The scrollback of my terminal vanished and when I scrolled a page in Firefox the X server crashed. Setting `vm.overcommit_memory = 2` is probably not the solution to the problem, it just seems to randomly kill programs that aren't able to deal with the OOM (in my case, the X server).
(When I first tried it on a running system, nothing worked anymore, probably because there already was a lot of overcommited memory. I could still type a command in the terminal, but it only told me that it could not execute it due to the lack of memory. A few seconds later the graphical interface crashed and I was left with a blank terminal (such as when you press ctrl+alt+f2), but without any possibility of interacting with it.
Offline
How exactly does your computer runs out of memory ? do you open many things at once ? after all 4GB Ram is a big number.
as for the freeze I think it's typical for any OS to slow down or freeze when it runs out of memory As it struggles to find memory for new processes, don't you think so ?
Last edited by niceman (2015-09-28 11:28:20)
Offline
How exactly does your computer runs out of memory ? do you open many things at once ? after all 4GB Ram is a big number.
Yes, the low-on-memory condition can certainly be blamed on me, there there are many open programs (and a lot of open tabs in Firefox).
as for the freeze I think it's typical for any OS to slow down or freeze when it runs out of memory As it struggles to find memory for new processes, don't you think so ?
Well, that's the part where I think differently – a single program overallocating (most of the time that's gonna be Firefox) shouldn't be able to take down the whole operating system. After all that's exactly why we have operating systems, so that programs that are not well-behaved do not take down the machine. My expectation would be that Linux kills the offending process (which it eventually does, but 30min+ late).
EDIT: As said above, disabling overcommit does stop the system from slowing down, it just has practical problems because processes other than the offender start crashing.
Last edited by heinrich5991 (2015-09-28 11:33:47)
Offline
Are you maxing out your processor while you are maxing out your memory?
Offline
Are you maxing out your processor while you are maxing out your memory?
No, I'm not. The "io_wait" value reported by the tool `glances` rises to high values though.
Offline
Try setting up some sort of RAM/CPU monitor so, when it freezes, you know whether or not it's memory.
Offline
Try setting up some sort of RAM/CPU monitor so, when it freezes, you know whether or not it's memory.
I had a terminal with `watch free -h` open, it told me that the computer was almost out of RAM when it froze.
Offline
The procedure in the link you posted is not going to do much if you don't have swap space to begin with. Try creating a swap partition or a swap file first as instructed in the wiki.
Offline
The perceived difference between having swap enabled or not was that the OOM killer was even more reluctant to kill processes when the system was kind-of-OOM, because the working memory exceeeded the available RAM.
Offline
Well, yeah, a hard disk is slower than RAM, but it should keep the system workable enough to manually close an application once the system starts slowing down. It shouldn't completely lock up when you exceed the 4GBs. Unless your hard disk is very slow.
I assume you'd rather want your system to get a little slow instead of processes randomly getting killed.
Or does the system freeze completely when it starts using swap too?
Offline