by Waterluvian · 8y ago · 0 comments
My computer at work has 16 GB. It gets slow. Every now and then, I'll open a web page that pushes things past a limit. The browser becomes completely unresponsive and sometimes I can't even move my mouse. While I'm suffering from running out of memory, the browser decides to use up even more memory to pop up a dialog to taunt me about it.
This can even happen without user action, for example when a page automatically loads a new ad. The ads on reddit seem particularly bad in this way. Randomly, one will eat all my RAM.
I often end up having to hold down the power button for 5 seconds. That, and pulling the power cord, are the only reasonable recovery. If I get "lucky", as I did a few days ago, Linux will kill the X11 server; this violently shuts down the whole GUI.
I really really hate the situation. I blame most of it on Chromium and Firefox, both of which don't make a serious attempt to keep things under control. A bit of blame goes to the fact that resources allocated in the X11 server can not be easily mapped back to web pages and thus kept within page-specific memory quotas.
If you enable the magic SysRq key, Alt+Print Screen+F will trigger the OOM killer.
Quick enable for those who want it:
kernel.sysrq = 1
in /etc/sysctl.d/90-sysrq.conf.> I blame most of it on Chromium and Firefox
I rarely have this problem with modern Firefox, but also block ads so maybe that makes the difference. Chrome is always bad, though.
The end result is roughly as bad as just rebooting, so I might as well just reboot.
There is no reasonable way to account for the memory.
The "reasonable way" to account for memory is to read the top(1) manual page to find out about the different memory usage statistics, then run top to find out which processes are using how much memory.
Fortunately I have a Linux desktop which is my primary machine, but I do still use this quite a lot when I’m working away from my desk.
For my part, whenever my computer is slow, browsers are almost always the cause. I typically restart one or both of my browsers (Chrome/Firefox) when my computer is slow or the fan is whirring like crazy.
--renderer-process-limit=4I almost always find that this is caused by a badly behaved website, not Chrome itself.
Some sites have horribly written JavaScript, or introduce ads that run their own CPU- and memory-intensive JavaScript.
Finding and closing those tabs, or disabling JavaScript, or using uBlock or uMatrix usually solves it for me.
If the question really needs answering, the poster should just get a heap profile. Some instructions are here: http://goog-perftools.sourceforge.net/doc/heap_profiler.html
You may also wish to try the memlog flag to chrome, or rebuild chrome with TCMALLOC_SMALL_BUT_SLOW defined. Warning: it does what it says.
This is exactly the attitude that leads to such problems. Applications that assume they can use all of the available memory on the machine are hostile to multitasking environments.
Entirely unused RAM is a waste if never used.
Yes, you can actually manage RAM more efficiently for your application, if you just reserve a whole bunch of it and work inside of that, but at best you'll trick your users into thinking your applications is fast, but it's not actually in the interest of the user. If they wanted to dedicate all RAM to your application, they would not have opened a second application.
Not the applications.
If you have very little, it will turn off many optimizations, turn on features that reduce memory (like tab suspension built into the browser), and overall adjust the whole browser to use less resources but go slower.
This is the case. 8 GB of memory, VM takes half of it, Chrome will happily take the rest with few tabs open and lock up my computer.