Live data from Hacker News

Browsers eating RAM

flotato.com

151–160 of 171 posts

Re: Browsers eating RAM

#151

Earlier quoted context omitted.

Yep. Safari is good, but it's not magic. I suspect psrecord doesn't catch Safari processes because Safari sends them off to launchd because they get launched via XPC, while Chrome's subprocesses are "true" children.

That is correct. I actually spend half a day trying to find a way to get aggregate memory usage of Safari. You can get most of Safari processes using plain ps as they share the same command: ps x -o rss,command | grep Safari There will be a few system threads (for example used for video rendering) that you will have to tie back to one of the processes using launchctl. Fun fact: activity monitor actually does it throu…

The kernel actually keeps track of this information in an internal "responsibility" field for each process. The private API to retrieve this information (which Activity Monitor uses) is responsibility_get_pid_responsible_for_pid, exported from /usr/lib/system/libquarantine.dylib.

Re: Browsers eating RAM

#152
post #144

Earlier quoted context omitted.

Chrome has a task manager that you can use to kill a stalled tab. The OS has a task manager that you can use to kill a stalled browser. You are never forced to use the power button and lose work.

That would be nice. Reality: the task manager will not open because there is not enough RAM. Simply moving the mouse pointer can become impossible. Attempting to close a window goes like this: estimate the mouse movement needed, carefully move the mouse, then come back in 15 minutes to see if the pointer has moved and if it is in the correct location. If it has moved but not as desired, make another attempt. If it ha…

Might be worth turning off virtual memory? I believe that is an option in all the major OSes, and it can help you budget your memory usage as well as avoid a swap lock-up. Is the underlying problem that your machine has just has too little memory for today’s OS & browser versions? Or you’re visiting a specific web site with a memory abusive app? It sounds here like there are important details you haven’t mentioned yet, not that there is a general problem with browsers necessarily. Yes, browsers and today’s OSes and applications all seem bloated from a user perspective and seem to use enormous amounts of memory. I have run out of RAM before and had to wait for VM swap, and agree it’s very painful. But I haven’t had that happen with a browser in years or maybe ever, and nobody I know is having common browser freezes. Is it worth an SSD & RAM upgraded, might that solve the issue?

Re: Browsers eating RAM

#153
post #152

Earlier quoted context omitted.

That would be nice. Reality: the task manager will not open because there is not enough RAM. Simply moving the mouse pointer can become impossible. Attempting to close a window goes like this: estimate the mouse movement needed, carefully move the mouse, then come back in 15 minutes to see if the pointer has moved and if it is in the correct location. If it has moved but not as desired, make another attempt. If it ha…

Might be worth turning off virtual memory? I believe that is an option in all the major OSes, and it can help you budget your memory usage as well as avoid a swap lock-up. Is the underlying problem that your machine has just has too little memory for today’s OS & browser versions? Or you’re visiting a specific web site with a memory abusive app? It sounds here like there are important details you haven’t mentioned ye…

It's an 8 GiB machine with an SSD. I open lots of tabs, in lots of browser windows, on lots of virtual desktops, but so what if I do? It's still unacceptable to lock up.

If I visit a specific web site with a memory abusive app, the browser is supposed to protect me. It's the same as any security hole. Malicious web sites aren't supposed to crash my computer.

Yes, I'm still blaming the browser. It's the browser's job to provide protection here. It's a security matter. No matter what my browsing habits may be, letting the computer lock up is not at all OK.

We shouldn't be one bad web site away from swap lock-up.

There is no possible computer upgrade that will fix the issue. There will always be a more-terrible web site waiting to consume all resources.

Re: Browsers eating RAM

#154
post #152

Earlier quoted context omitted.

Might be worth turning off virtual memory? I believe that is an option in all the major OSes, and it can help you budget your memory usage as well as avoid a swap lock-up. Is the underlying problem that your machine has just has too little memory for today’s OS & browser versions? Or you’re visiting a specific web site with a memory abusive app? It sounds here like there are important details you haven’t mentioned ye…

It's an 8 GiB machine with an SSD. I open lots of tabs, in lots of browser windows, on lots of virtual desktops, but so what if I do? It's still unacceptable to lock up. If I visit a specific web site with a memory abusive app, the browser is supposed to protect me. It's the same as any security hole. Malicious web sites aren't supposed to crash my computer. Yes, I'm still blaming the browser. It's the browser's job…

If it’s unacceptable to lock up, then turn off virtual memory. Swap is not a security hole, it’s a feature doing exactly what it was designed for. Swap is the explicit design tradeoff of the system you bought, and it’s the default behavior because most people prefer that their system work slowly to a system that stops working. Fortunately it’s an optional feature, and you can turn it off.

> I open lots of tabs, in lots of browser windows, on lots of virtual desktops, but so what if I do?

Hehe, the expected outcome of this behavior on an 8 GiB machine with default settings is a slow computer. You can blame the browser and spend your time frustrated if you want to, or you can choose to avoid asking the computer to use 20 GiB and then complain when it swaps, by requesting less memory and/or disabling virtual memory. It’s not that fair to go on and on about some vague abstract idea of malicious web sites and blaming the browser for not protecting you, if you are choosing to open lots of windows, browsers, desktops, tabs, and web sites.

> It’s the browser’s job to provide protection here.

If you study the browser design, and if you compare today’s browsers to those of 5 or 10 years ago, you will find that all the browser devs are actually bending over backwards trying to help you. They’re not perfect, but all of today’s browsers are pretty amazing in how well they handle low resources - but - the browser is just an application that does what it’s asked to do. If you use a web app that consumes 1GiB, the browser tries to accommodate your request. How is it supposed to know you want it to cut off the app instead of do what you asked? What if the app asks for more memory in the middle of what you’re doing, do you want it to lose your work??

The OS is the software locking up your computer, not the browser. Everything you’re talking about can and does happen with regular applications. Even if you got your wish of a browser that protected you from yourself, it wouldn’t solve the problem that landing in swap locks up the machine.

> There is no possible computer upgrade that will fix the issue.

I disagree completely. I never have the problem you’re talking about, and I use dozens and dozens of tabs all day long every day with multiple browsers. $100 in RAM right now could double or triple your capacity, if you don’t want to disable virtual memory nor change your browsing habits.

Yeah there is no solution to fixing the theoretical problem that some software somewhere can ask for more resources than you have. That’s not the issue you brought up though. In practice, the issues you’ve raised about browsing are quite easily fixable.

Re: Browsers eating RAM

#155

The whole browser situation at the moment is so incredibly frustrating. I will NOT browse the internet without a fully-fledged adblocker - no pihole is not enough. This means pretty much only using Firefox - but I have about 10 tabs open at the moment, each using over 500mb of ram while idle. What on earth they are doing I don't know... and I find it very sluggish when playing video. Chrome is my daily browser, even…

I'm in the same boat.

No matter how much I like Safari optimization, taking advantage of OS, eye candy, etc. - this is all SECONDARY to a full functional ublock origin.

This is non-negotiable.

Re: Browsers eating RAM

#156

Earlier quoted context omitted.

What ever happened to computers being at least somewhat usable when all RAM is in use? I seem to remember that being a pretty common condition back in the 90's. Things would get slow, sure, but not completely and utterly hosed. When this happened to me recently (unattended Firefox process used up all RAM) the machine was simply never able to recover, even after killing the offending process (thereby making 30GB or so…

It was nice when the OS was 64-bit and multi-threaded, but the browser was not. The browser couldn't grab more than 1 CPU and 4 GiB.

On modern macOS/Chrome it'll be impossible. But on other platforms you can still run 32bit chrome (other browsers)

Re: Browsers eating RAM

#157
I'm by no means a Google shill, but RAM is meant to be used. What's the point of my RAM if it's just going to sit there...doing nothing, gathering dust, all the time?

I read some comments complaining about slowdowns and I just have to chuckle. You do realise computing technology grows exponentially with time, right? Your hardware is outdated by the time you get your hands on it, and only gets worse performance-wise as time progresses. This has been true in literally every era of personal computers.

You can't seriously expect a CPU from nearly a decade ago and, what I assume, barely 6GB of RAM to sustain your 10+ tabs, YouTube videos in HD/4K/etc, and your heavy workloads outside of the browser at the same time without some slowdown.

I'd agree that modern browsers (and applications in general) have become more resource hungry, but do you think these new and fancy features come without a cost?

If you're so concerned with memory usage, why not use wget instead of a browser?

Re: Browsers eating RAM

#158

Earlier quoted context omitted.

Isn't that just the same as installing a PWA? ( https://developer.mozilla.org/en-US/docs/Web/Progressive_web... )

Exactly but with the benefit of using the Safari engine and some other bells and whistles

Safari can install PWAs using the Safari engine while also taking advantage of the same Content Filtering API measures you use to get rid of crap.

I am not sure what this product really achieves.

Re: Browsers eating RAM

#159

I use Safari because it's best by a mile on macOS for power consumption, but if you ever use a memory hungry site like Facebook for more than a few minutes it throws up a memory usage warning and everything becomes extremely slow and you get astronomical scroll jank. I'm guessing that's because it throws a hard cap on tab memory usage and if you go over that it thrashes wildly. So it respects your system, but in doin…

I have a MBP 16" and from testing/experimenting...I get about ~5% less battery life when using Brave, than when using Safari.

So the power consumption thing is quite the myth as well.

Re: Browsers eating RAM

#160
post #49

Earlier quoted context omitted.

Security and stability is an other tradeoff: isolating code by running it in separate processes has a cost both in terms of memory and CPU.

Safari has separate processes.

Chrome takes this to an extreme. It has a process per site instance rather than a process per site. You can toggle this by feeding it —-process-per-site as a command line argument.

Safari provides slightly less security in exchange for less resource usage, since some websites allow multiple user accounts to be logged in at the same time and Chrome will protect users data better in those scenarios.

https://www.chromium.org/developers/design-documents/process...

Post reply on HN