back

by dmit·10y ago·view on hn ↗
RAM is meant to be consumed. If your browser is using 50MB of RAM and has to swap every background tab to disk then you're not utilizing the resources of your computer, and getting a crappy user experience as a bonus.
9 comments
>If your browser is using 50MB of RAM

If only that were a relevant remark. The tab with the linked Oryoki web page alone is using 250 megabytes for me. And a second tab of the same page is using an additional 230 megabytes.

Somehow I don't think that that's well utilized RAM for the ~350 kilobytes of web content. This page uses 200 megabytes as a tab, and HN isn't exactly a heavy page.

Seriously. I remember having 10s of tabs open in Firefox on an XP machine with 256MB RAM total, and it performed relatively well.

At first I was going to blame all of the garbage from rockstar brogrammers, but even the simple HN comment page tab is using 264MB of RAM on macOS. The browser itself uses an additional 208MB according to Chrome's task manager, not counting all of the extensions. Where is it all going? There's 10 lines of JS on this page and a tiny amount of CSS. Has Chrome become that bloated?

This is especially annoying when many modern "desktops" apps are just Chromium wrappers that bleed memory.

Does it really use all that memory or does it pre-allocate it and does its own memory management inside? Not that it’s better, but that would explain why it takes so much.
There is a lot of shared memory between renderers and the browser.

Your 208MB might not be additional, but a big subset of it could be shared with the renderer/gpu process.

If you want to know where the memory is going you can go to about://tracing and enable the memory-infra category.

It's not really chrome's fault. Blame it on increased screen resolution, copious amounts of available ram and a requirement to prefer using less cpu than less ram. Which also has the nice effect of using less energy.

If you have ram and it is not being used, it is completely wasted, if you have cpu cycles and it is not being used you are just saving on battery and not over heating the laptop.

>Blame it on increased screen resolution

Maybe on 3 or 4K laptops. But aren't most 1388x768 or something equally dismal? Which isn't far off 1024x768. Anyways, a 1080p frame at 32bit depth is only 8MB.

Browsers are hardly low CPU, either. I'll see things idling at 10% of an i5. Which is like 200%+ of CPUs used for web browsing of yesteryear.

All this, and web pages are slower to respond. I recently used a page that loaded a grid of images. Changing by battery/throttling had a 2s impact on load time. CPU was pegged during that time.

Never assume your application is the only application running on my machine. And never assume I will be running only one version of your application.

My girlfriend who is a non-power user regularly has 2 browsers open and her laptop is swapping constantly with it's 8G of ram.

Sure RAM is meant to be used, but not when the browser just consumes it forever, until it begins grinding to a halt. What could a browser POSSIBLY be doing with 4-500MB of RAM PER TAB? It's a huge problem, and extensions like The Great Suspender should not have to even exist.
Each tab is a separate process. A separating operating system, you could say. Would you complain that your OS needs that much RAM? I wouldn't.
Except we're not running an entire operating system in each tab. Everything starts fine, and then quickly consumes memory. How about we just stay fine? I've got entire operating systems running with less resources in VirtualBox.
My operating system uses less than a quarter of the memory that a single tab in Chrome uses. And that's with X11 running. (OpenBSD 5.9, btw).
What's your point?
My point is that if you think of a browser as an operating system (which I don't), it still uses a ton of RAM, even in that context.

And, for the record, I would complain if my OS was a memory hog.

Now, get off my lawn!

/me shakes his cane at all the youngin's running around with their copious amounts of RAM

:)

Yes, RAM is meant to be consumed, but I still find it incredibly hard to believe that my browser NEEDS multiple gigabytes of memory. Regardless of how much I have to spare.
Is this a problem a browser can solve? I mean modern websites are so large with so many crappy stuff and always loading something in the background - if you have 15-20 tabs with similar background loading web sites your browser is bound to consume a lot of memory.

If I am not missing something obvious, aren't we blaming the wrong thing?

I'm not sure about that. Chrome's Task Manager says this HN post is taking 255mb and the front page 101mb.
That's weird. Chrome is only using 31 MB for both tabs for me.
Do you think it's related to the display? I'm on a 15 inch rMBP.
I see your point, but I don't find the state of things incredibly surprising anymore. Consider how huge modern web pages have grown, with a ton of poorly compressible media attachments, an embedded programming language that keeps track of plenty of state, and dozens of external resources that pull their own media and have their own state. Not to mention that we're in the middle of a responsiveness space race between browser vendors, and doing less CPU work by keeping more things in memory is one of the basic performance optimizations. With that said, as developers we have obviously been spoiled by the embarrassment of riches in terms of available hardware resources and have also contributed to the problem.
I think that really depends on what you are asking your browser to do.
>RAM is meant to be consumed.

By users, not developers.

Edit: I know, I know, I know... But you all get my point.

I understand your point, but there is inefficient vs. efficient use of resources. You could say it's ok to package a toothpick in a shoebox because cargo space is meant to be consumed.

When the ASCII text of a webpage is measured in tens of kilobytes, and the RAM in hundreds of megabytes, something is wrong.

There are solutions for this.

I assume you're running up on your RAM because (like me) you have tons of tabs open?

If you're one of those people, consider The Great Suspender: https://chrome.google.com/webstore/detail/the-great-suspende...

Also, have the right extensions. E.g. microadblock instead of Adblock Plus, etc. etc. There's a balance to be achieved somewhere in there. :)

I wonder if part of the solution is smarter caching at the OS level. Do all modern operating systems give the application a way to tell the OS, "This chunk of memory is a cache, so free it if it's needed for something else"? Of course, when the OS frees that memory, the app would need to know about that, so it can re-fetch or re-compute that cached data the next time it's needed.
They almost all do, yes. Android offers volatile ranges, OS X offers purgable pages, Windows offers MEM_RESET/MEM_RESET_UNDO. To my knowledge Linux is the only exception, because last time I checked they haven't merged Android's patches to enable the feature.
I have good gear but definitely not the latest and greatest of everything. My laptop is a macbook pro from 3 years ago. My desktop has an Intel 2600k and 16gb of ram. Both run on SSDs. I use my laptop for work. Rarely have less than 20 tabs open in chrome, which stays open for days/weeks at a time. I've got VMs running and xCode, sublime, ios simulator, bunch of terminals, bunch of node apps, couple corporate sec products and incremental backup software, etc, etc.... Not a single thing is slow about anything. And I'm anal about things being slow. I hate waiting for anything. Its the same on my older desktop, which I also game on. I don't shut down my browser before playing games to free up ram, or kill photoshop, etc.

Unused ram is useless ram. Its a problem when you're always out of ram. But get an SSD for the odd times you swap. You won't notice it. But either way, the only time my browser is slow is if I restart it and it loads my previous 20-30 tabs all at once. It'll do its thing for 10-20 seconds then done.

I get its a lot of ram but what I don't get is why this is impacting people so much? In this day and age most of what people do is in a browser. And if you only have a tab or two and you're working outside of your browser, and you think your browser is killing your computer? Maybe its time to upgrade or add some ram.

You can get 16gb of ram for $50/$60... I abuse my machines with multitasking all day and none of them feel slow because my browser uses too much ram. Both have 16gb.