Hacker News new | comments | show | ask | jobs | submit login
Ask HN: One tab on Chrome takes about 100MB memory, why?
208 points by ausjke 9 months ago | hide | past | web | favorite | 202 comments
with say 30 tabs open, 3+ GB is gone, chrome is such a dominant memory consumer! in fact it takes about 10X more memory than everything else combined on my ubuntu all the time, why?

Yes I use onetab extensions etc to save memory, just wondering why one tab takes so much memory, is this a design fault?

(I have worked as an engineer on both Ubuntu and Chrome)

> One tab on chrome takes about 100MB memory, why?

It probably doesn't.

Much of that apparent memory usage is shared between all tabs, and the browser renderer process, etc. in the form of shared memory.

Quite a bit of it will be the executable code itself, which is "mapped" into memory, given an address, and allocated the full size but doesn't actually consume memory until it needs to be read from disk.

And a large part of that memory is going to be the giant white pixel buffer that you want it to draw into, which is typically mapped to a texture buffer in the GPU memory.

If I Shift-Esc in Chrome with one tab open, it shows that this tab ("Add Comment") consumes 0 bytes of shared memory and 163 828 kB of private memory.

Current window size is 1280x800. Assuming the render buffer is ARGB32 and assuming one render buffer (which is probably an incorrect assumption) that should be ~40MB. The GPU memory is listed as a separate entry in that view, but I don't know if that is also included in the "private memory" listing.

Going turn off javascript and restart and see what it says then.

EDIT: 164 856 kB w/o JS. So no change (relatively).

Zero bytes of shared memory? So you have no other processes running which have libc loaded in?

    $ ldd chrome | wc -l
Shift-Esc is Chrome's own task manager. I don't know how they count.

Additionally, the number you come up with (as "MiB of RAM used by an application") might also depend on the OS features the application uses and not directly be obvious by its functionality.

Example: I've been doing some experiments around DWM thumbnails in MS Windows. My program doesn't really do much and shouldn't use too much memory (and doesn't, at least initially). I create a thumbnail for each visible window on the screen (say 5 of them), and -ding-, my process uses >400 MiB.

But Windows itself does this when you hover over a taskbar entry, right? Explorer is never that heavy for me.

Or is the process totally different?

A compositor doesn't create a separate image for stuff like this. Every window is rendered into a texture and things like thumbnails are simply a small texture-mapped quad; it's done for each frame by the GPU.

Okay, may be OP's estimation of that being a per tab usage was not quite right, but why does ~30 tabs result in 3GB+ of usage?

May be happening for other people, but I've never had this happen. 60+ tabs and it never breaks 2GB.

My "private bytes" numbers very from 50 to 300MB per chrome process, so that's not counting shared memory or untouched memory.

An HD pixel buffer is only 6MB.

> An HD pixel buffer is only 6MB.

Don't forget that the browser splits out different layers and composites them together, so it'll be a little bigger than that.

Because it is 2018 and people have forgotten how to static HTML. All that lovely rendering code in your browser goes unused as people rewrite it in Javascript, badly; or even in C++ and then compile to web assembly, that’s all the rage now, because why stick with one layer of abstraction when you can involve three?

Oh, and of course everyone rolls their own, so that website with the dancing pigs not only has its own stack, but also one for every ad and tracking network it pulls in. It takes a whole lot of javascript to provide that transparent pixel!

The situation is no better on the server side, of course. Why write static HTML for your pageful of text when you can have a web framework pulling C++ from a SQL database, compiling it to web assembly on the fly and vomiting forth to the browser just in time because someone might want their flying unicorn background to have different colour sparkles and pointing those people at a different static location is just gauche.

No, I’m not bitter, far from it. It all makes work for the working man to do.

However if you open a static HTML website such as the tasteful http://motherfuckingwebsite.com/ it still shows 122 MB used in Chrome Task Manager in spite of the source being 0.005 MB.

Eh, even that site uses Google Analytics. There's a comment in the HTML:

    <!-- yes, I know...wanna fight about it? -->

Someone should paste in the obligatory evolution of this concept in the form of the simpler sites people have put up...do not have them committed to memory/bookmarked, but I know someone here does.

Oh no

Writing small footprint website helps, but the major culprit here is Google Chrome. It consumes way too much memory per tab (compared to Firefox on Linux), I've heard it's because it has a strict «one process per tab» policy, whereas Firefox has several processes but not one per tab.

Chrome doesn't have a strict one process per tab, but doesn't cap it anywhere near such a low number as Firefox (currently) does.

You're wrong. Empty page with no scripts still costs 100MB of ram.

I don't know, WebAssembly compiles to very small blobs (if done right), you can get a lot of functionality out of a few KBytes. Imagine if we could throw out all the high-level crap from the browser core (WebAudio's node graph, all the video and audio codecs, HTML/CSS/JS engines with all legacy features they need to support, etc etc... and replace that with wasm modules which are only loaded on demand. Then browsers would become much smaller, and web pages would only need space for the features they actually use.

Of course this wouldn't be a 'web browser' in the traditional sense, but a (reasonably) safe runtime platform for untrusted code without a central 'Big Brother' who decides what is good or bad for users.

I’ve not seen much WebAssembly “done right” to date; IME it is most often employed to spew gargantuan legacy C++ applications verbatim into the browser to avoid having to understand which parts are actually desired, whether and how they can be unpicked from the rest, and whether they are trivial enough to actually just reimplement in Javascript or otherwise as standalone modules. This does not bode well for the utopia of small clean blobs you propose, though I do agree it would be nice if it came to pass.

I am perhaps too pessimistic here; wasm is young and has still to develop much of its own culture. I shall watch that space with interest.

Historically, Emscripten produces pretty large binaries, but that's because it's also trying to make transitioning from desktop code to the web easy; therefore it includes a bunch of its own runtime.

They've been doing a lot of work to cut it down lately. As wasm grows, and this becomes more of a focus, it should get really small.

On the other hand, LLVM's new backend means you can skip that runtime and get very tiny binaries; the smallest file I've gotten rustc to produce when compiling to wasm is just over 100 bytes.

Check out these samples: https://floooh.github.io/sokol-html5/, the wasm blobs there are between 8 KByte (for the clear sample) and 210 KByte (for the ImGui sample), all compressed size as downloaded by the brower. Most of the samples are done in C, the ImGui sample is C++. You have to pick the right C++ subset ("Modern C++" is pretty much what not to do if you care about binary size, instead use the C++ subset that's common in the embedded world). It's much easier to write slim code in C since this is a much simpler language and it's not so easy to hide a lot of crap under 'abstractions'. Of course if the C++ codebase is already bloated that's impossible to get small for WebAssembly.

Common sense is still required (which is unfortunately very rare in the modern programming world).

Don't worry. If we've managed to blow our binaries up to 100s of MB, we can do it with our websites, too!

(Seriously. Chromium is 124MB. How does anyone think web dev will go differently?)

We will never go back ; there is only a tiny niche group (embedded, retro and demoscene) that cares about tiny and efficient. The rest simply wants to deliver features fast. On their (I include myself in that often) island, most reason that computers are fast enough and have enough memory. But that arguments really does not take into account things like: multitasking (if all devs think like that, what happens when you run 20 apps at the same time?) and, in many cases, battery life (that does not have to be the case; bloat does not have to hog cpu but often does).

It's better yet if we can deliver features fast with internationalization, accessibility, security, maintainability, and so on. Whenever I dabble in retro computing, usually via emulation, I appreciate how much progress we've really made. And if a phone needs 2 GB of RAM, and a laptop needs 8, well, the world has much bigger problems.

And a lot more websites would be inaccessible to blind people, and people with other disabilities, because those lean, mean WebAssembly blobs wouldn't include the accessibility support that's built into the current bloated browsers. No, web accessibility isn't perfect, but I think throwing out what we already have could only be a step backwards.

Open a few hundred tabs on Android (where no Google developers have special 64 GB, or even 32 GB of RAM phones) and you will see it does just fine. So it's not about what the web is or isn't.

Automatic tab discarding is very aggressive on mobile installations compared to desktop. They used to let you enable that feature in the desktop browser if you like having tabs that reload when you switch back to them - no idea if they do in the current builds

Sadly that feature is no longer available. >_<

That feature is absolutely available, and enabled by default on all chrome installs. However it only kicks in when needed in low-memory situations where that memory is needed elsewhere.

>The situation is no better on the server side, of course. Why write static HTML for your pageful of text when you can have a web framework pulling C++ from a SQL database, compiling it to web assembly on the fly and vomiting forth to the browser just in time

Any example of where something like this is actually used?

I'm also interested in hearing why browser rendering code goes unused when displaying a javascript-powered site.

With PHP there are a bunch of people who put PHP fragments in a database and pull that together with some queries, append and eval it. I wouldn't be that surprised to find someone doing it with PHP fragments echo'ing some JS.

It's certainly _possible_. I just think it was unnecessary hyperbole that doesn't really have anything to do with the topic at hand, since a static pure html website is going to use a lot of memory on Chrome anyway.

Expectations for the web are different. Also, there are more applications running in a web browser than there were in the past.

Aww, come on.

People want and expect websites to be very close to web applications that react to who you are, what actions you take on the page and a myriad of other factors.

That's just not possible with static HTML.

I fundamentally disagree. I don’t think ‘people’ really do want that.

That reminds me of the thinking during the 90’s and early 00’s that everyone somehow must want 10 browser toolbars that spam them with ads all the time.

Well, that wasn't really about what they thought people wanted, it was about what toolbar makers thought could get away with (or trick people into). They wanted everyone to use their toolbar filled with ads. And some unsophisticated users ended up installing 10 different toolbars.

An example from the late 90s might be the idea that people wanted intro animations and music on web sites, heh.

Obviously, it depends on the site.

However, when you're on YouTube you don't want the site to suggest videos you're not interested in (or Amazon, products).

When you're on a blog, you don't want "related articles" to list articles you've already read.

Etc. Etc.

I don't know if people want this--in part because they don't even realize these features exist--but I'm sure the opposite can be annoying.

It also depends how modern techniques are used, but arguining that we have to go back to static HTML because it's better doesn't make sense to me.

As a user of both YouTube and Amazon.com I really don't want either recommendations you mentioned. I go to YouTube to watch specific videos and I go to Amazon to buy specific things. Those organizations want to give me recommendations but if I could turn them off and gain performance I would do that in a heartbeat.

Ah, I see. I discover awesome things on both platforms this way.

On the performance side, Hacker News still takes 100MB of memory in Chrome, so...

You cannot create an efficient static page with recommends below a video?

(clientside that is; serverside it would be dynamic but Chrome should not be bothered, it is, but that is another story)

A slow one, yes.

I have a whole separate rant about HTML5+CSS and Turing completeness, but responding with that here would make me part of the problem.

In all seriousness, we need waaay fewer layers of dynamic abstraction than actually get employed to solve most problems.

If tools are used incorrectly, it's a problem. But don't say that static HTML was better or would be better, because it simply wouldn't on a high percentage of websites.

> One tab on chrome takes about 100MB memory, why?

Two reasons

1) Because, Chrome is ready to do something with that tab: browse the web. Do this, create a browser that doesn't use much memory when a tab is idle. Switch back to that tab and interact with the page or go to a new page. You will experience latency. It will feel slow. That's why the tab uses a lot of memory. It is staying ready at all times to be interacted with by the user and the network.

2) The real reason: Chrome either has no memory budget or the memory budget was set to 100 MB. The engineers decided that some amount of memory usage was acceptable and that's what you get. If a new budget was created, say 10 MB, then what you would see is some very clever engineering to overcome the problems in the first reason I gave. Chrome would be responsive at all times and use very little memory per tab, but at great engineering cost. It would be very difficult, but interesting work.

I'm perfectly willing to wait a second for the page to be reloaded from solid-state storage, if I haven't visited the page for an hour or more.

Some people might say I shouldn't keep hundreds of tabs open for weeks. But I'm an old guy, and by my standards my laptop is a freakin supercomputer, so in my mind it should be able to handle all the web pages I can manually throw at it.

As a person who also has way too manu tabs open at all times, I've had success with the great suspender [0]. It "suspends" pages after a timeout so they use less memory.

[0]: https://chrome.google.com/webstore/detail/the-great-suspende...

The current version also has a bug where it will create so many cookies on google-owned domains that it will exceed the header limit and cause a 500 response. The dev refuses to fix it until he implements a feature to make suspended tabs persist across updates, which is apparently slow going.

Well, it is opensource so anyone can fix it for fun or profit: https://github.com/deanoemcke/thegreatsuspender

Seconded. I reliably have a few hundred tabs open, and GS keeps them all manageable.

It’s not always happy if Chrome crashes or I have to do a cold reboot, but mostly it keeps Chrome’s gluttony under control.

At this point why not just use something like OneTab? It also syncs the tabs across many computers.

Well chrome will "suspend" tabs when it sees your system is running low on memory, and will resume them when you switch to them.

But it's a much harder problem to solve than many think. For example, if they start "suspending" my slack tab, or my email tab, and I begin missing messages I'm going to be quite upset...

That doesn't sound like a reason for it to be hard - just provide a way to mark tabs as "don't suspend". I have only a couple I would put in that category, and I really wish Chrome would stop burning up all my resources and battery on the rest (often it's not a specific tab, just the "Browser" process, so I can't do it manually).

I'm pretty sure the amount of users that actually like this opt-out behaviour (everything gets suspended by default) is a minority.

Instead what they choose to do is not worry about memory until it you actually run out of it. I don't mind my applications taking up 90% of my memory if that keeps everything fast and I don't have to worry about keeping track and thinking about what I actually want to suspend and what I dont't.

If you really do mind, just run any of the plugins that implements your exact required behaviour (like the great suspender).

Next step: Limit the amount of memory available to Chrome so it thinks your system is running low on memory earlier.

> I'm going to be quite upset...

You'll get over it, I promise.

I'd just end up using another browser that doesn't purposely slow itself down or make me miss notifications or stop background activity unnecessarily.

Why the extreme majority would want that from their browser all the time baffles me. Just to see a lower number in a resource monitor window?

Firefox keeps alive pinned tabs, don't know about chrome

If one tab uses about 100MB of memory then does two hundred tabs use 20GB of RAM?

You say you sometimes have "hundreds" of tabs open, I've done this too, but my laptop doesn't have 20GB of RAM, but it just seems to work anyway.

What I ended up doing was: just stop looking at resource monitors.

I don't know but it eventually bogs down the computer. Fan starts running hard and everything's slow until I close down a bunch of tabs.

> I'm perfectly willing to wait a second

I'm not. I open dozens of pages simultaneously routinely. 1 second here, one second there, it adds up.

Sure, it's not the end of the world, but those differences were why Chrome was better than Firefox.

You cut off the "if I haven't touched the tab in an hour" part.

How many times does that pretty-narrow situation happen to you in a day?

If you had such a memory-saving mechanism, boosted by prefetching the tabs adjacent to my current tab, it would barely cost me any seconds in an average week. Running low on memory is a big hassle taking a lot of seconds to deal with.

That one second makes me want to smash my device to pieces.


And stop being quite so snarky to users who may not know about these hidden settings.

Another implied solution perhaps... don't use so many tabs? (I promise you, I'm speaking to myself as I say that. I use way too many, myself)

I'm currently at 30 Firefox tabs and it's using 1.24gb of memory. Much less than 100mb/tab.

Firefox recently switched to a design that tends towards a higher base memory usage than Chrome, but a lower usage for each new tab. With the same 30 tabs open and no extensions, the current Firefox uses ~30% less memory than Chrome. But opened only to one tab, Chrome uses ~60% less memory than Firefox. It's an interesting tradeoff.

1 is entirely possible. Opera 12.x takes ~3-10MB per TAB (+the weight of the media used on the page). There is zero latency, opening new/switching tabs is instantaneous.

Google devs use 16-32 core machines, often with hundreds of gigabytes ram. Why would they bother optimizing?

FWIW, I'm a Google dev and my only computer is the same 2015 15" MacBook Pro that many of the people reading this have had. Anecdotally, most of the developers I see are in the same boat (using a rMBP as their primary machine).

Many of the folks who work in our monorepo have an additional Linux workstation - not sure what the specs are on it, or what the average split is between laptop and workstation surfing. I also haven't paid that much attention to see if the folks I know on the Chrome team have substantially different usage.

>Google devs use 16-32 core machines, often with hundreds of gigabytes ram

You obviously have no idea what you are talking about. Most devs at Google use MacBook Pros.. which cannot even be upgraded to hold hundreds of gigs of ram.

The standard setup is a Linux desktop workstation - typically 6-8 core and 32-64gig ram depending on age (although there are some special set ups).

The required build tools and software for the internal engineering systems aren't usually available on a Mac so you'll need to have a Linux machine (physical or virtual) somewhere to remote into to do any dev work (again some teams are different but the bulk of engineers use the centralised Google infrastructure for source control, builds etc)

In addition to the desktop, every engineer gets a choice of laptop (Mac/windows/Chromebook) as well for email, meetings and cat videos.

Non-engineering just get a single laptop. Many many people now pick to use Chromebooks.

Chrome devs are given both a laptop (most choose a MacBook Pro) and a fairly beefy desktop. My one had 64G of RAM, and that was given to me six years ago.

Are those 64GB for browsing the web as parent poster claims, or for compiling software, leaving much less for web browsing?

Did you know that it remains free when you’re not compiling in a moment?

The standard machine has 32 GB. So I guess 0.32 hundreds... And for completeness, 6 physical cores, 12 logical with HT. Still beefy, but nothing out of the ordinary.

I would venture to say that most of the world isn't using computers with 32GB RAM...

I consider 2GB acceptable, 4GB normal, and 8GB high-end (maybe even overkill).

Strange, that's the metric I personally used around 2008. Haven't ran into a computer with less than 16GB for the last few years.

A rather popular hardware site in a developing country, but one on the upper range of "developing". So probably better off than 60% of the world's population:

399 laptops with 4GB of RAM: https://www.pcgarage.ro/notebook-laptop/filtre/memorie-capac...

548 laptops with 8GB of RAM: https://www.pcgarage.ro/notebook-laptop/filtre/memorie-capac...

Less than 200 laptops, in total, with 16GB RAM or more. So probably less than 20% of the laptops on sale have that much memory, in 2018.

The "real" world is quite different to what us folks in IT see in our corner of the world.

8GB is still a pretty common setup

* Literally every current MacBook except the 15" MBP

* iMacs unless you choose to upgrade the RAM

* My local PC retailers website has 34 models with 4GB of RAM, 84 with 8GB and 28 with 16GB. The cheapest 16gb laptop there is €1100. They also sell 3 Chromebooks and 1 windows 10 device with 2GB of RAM..

Especially since 32GB DDR4 RAM currently cost ~$350.

You are so wrong. Check here http://store.steampowered.com/hwsurvey/

these are gaming, most powerful PCs people are using. 8gb is 44% of all users.

I believe dgquintas is describing the standard engineering workstation at Google.

>most powerful PCs people are using

No, workstations and\or graphical stations are powerfull. Gaming rigs can be powerfull, but most of the time they are average or just above average.

Also - steam statistic will show you a great number of PCs that are being used only to play some indie games and\or Dota. 8gb is more than enough for that.

Depends on how you define "power". I'm sure devs often have more RAM for VMs etc, where gamers have more GPU for graphics. I'm building a gaming rig right now, the games I wanna play 8GB of RAM is plenty.

But if you click on the RAM section, 40% have 12gb or more.

yeah, sorry, I was referring specifically to the Google developer standard workstations.

Batch reply to the other comments: the "standard machine" here refers to what Google developers are using.

Are you talking standard Google developer workstation specs? That's not much different than the thinkservers we use as desktops. But considerably beefier than what non-desktop devs might be accustomed to.

Surely 16Gb was more common at least until recently? Haven’t seen many 32gb ram mbp in the wild. Actually, I’ve never seen one.

Apple doesn't even offer a 32GB option for their Macbook Pro computers. 32gb is far from standard.

Yes, they don't offer that on their laptops, but what the OP is talking about is a desktop machine. Apple definitely offers 32 GB in their desktops.

OP is talking about the machines Google devs use, and I am betting they are definitely not desktop machines.

He was describing the standard desktop workstation at Google.

My understanding is that they have rMBP laptops and slightly beefier desktops.

some people have macs, some other people have thinkpads (at other points in time, there have been dells or HPs as well). But only desktops are actually used for any development.

they are desktop machines.

320 = 3.2 hundreds not .32 hundreds. 3 hundreds, 2 tens, and 0 ones.

But, he said 32 GB, not 320, so it would be 0.32 hundreds.

Right. What do you get when you divide 32GB by 100MB per tab. It's not .32 hundreds. It is 3.2 hundreds.

> The standard machine has 32 GB. So I guess 0.32 hundreds

His comment was in response to Opera 12.x takes ~3-10MB per TAB (+the weight of the media used on the page).

>Why would they bother optimizing?

Because they're also targeting Android devices.

This incidentally is why I chose a OnePlus: for its 6Gb of RAM.

this is supposed to be exaggerated but who the fuck uses a 32 core computer with hundreds for gigabytes of ram. Do you mean their data centers?

The numbers might be slightly exaggerated. Nonetheless, they’re high-end machines.


My dev workstation at work has 20 Xeon cores w/ HT (so 40 threads), 64GB RAM and a 1TB NVME SSD. All that hardware sees plenty of use when compiling large C++ applications.

My home machine has 4 i7 cores w/ HT, 32GB RAM & a 1TB SSD. Compiling stuff on that one is ok, although quite a bit slower.

My desktop has 128 GB with 32 cores.

What CPU/mobo you using?

The one I mentioned is a precision w/ 2x2680. These dropped in price and flooded the market after leases finished. There are too many problems and finicky nonsense with adding extra video cards (due to the power supply). I also have an HP w/ 2x2680v2 128GB on the way. Using the HP I'll be able use for some projects a few of the old nanos and 295x2s I have sitting around. These are so cheap now.

Reminds me of this, https://medium.com/@timgasser/build-a-16-core-128gb-server-f... Looks like from supply and demand those prices increased a bit.

It's more expensive to build one than to buy one, which is why I said I bought some off lease. I've bought systems not (generally higher priced) parts that were scavenged or not sold.

I had misread that, thanks.

Do you have any model numbers or suggestions as to where to buy this sort of stuff? I want to get (always wanted really) a dev server for home.

Most amazon employees now use ec2 instances as their development environment so using a x1e.32xlarge with 128 vCPU's (64 cores over 4 sockets), 3,904 GiB of memory, 2 x 1,920 NVMe GB drives, and 14,000 Mbps of EBS bandwidth is possible.

Granted, I don't know anyone that uses that much and you would probably get asked by management for using a dev desktop that big but you can if you need to. I myself use just a i3.xlarge with 4 vCPU's, 30.5 or memory, Up to 10 Gigabit of EBS storage and 1 x 0.95 NVMe SSD.

In modern days, it is usually a web page / app, who takes memory, not the browser environment itself.

E.g. I am developing a web photo editor https://www.Photopea.com . When you open large documents (dozens of layers in high resolution), it can use 4 GB of RAM or even more. That is simply because decompressed images are large. No matter what browser you use.

But I am still shocked about the memory requirements of some "modern" web apps. My app Photopea uses 80 MB after loading (with no documents open), because it has already loaded some brushes, patterns, gradients, shapes, and generated raster thumbnails for all of them.

GMail uses 280 MB right after loading. This is quite shocking, knowing that it should contain mostly text content.

GMail has a ton of Javascript. The basic HTML interface uses closer to 10MB (a bit tricky for me to measure in Firefox, since it doesn't use one process per tab)

And what functionality does it provide for that tons of javascript? I am asking honestly because most of the magic of gmail (which I love) is on the server side. The functionality that it has on the client side is trivial and in some cases atrocious. In these days it cannot even resize the compose box. The power of it's search bar should require trivial amount of client side code, so should the auto save. The only thing that should take up memory is client side caching of inbox which is primarily text.

What I'm missing here I'm honestly totally confused.

(Key point: Gmail uses over 100MB where FastMail uses 10MB. Careful engineering helps a lot.)

Gmail provides a lot more functionality with that JavaScript than you may think. There’s a fair bit of magic that goes into making an email client work as you want it to.

That being said: most web apps are surprisingly inefficient in their memory usage (I find it surprising, anyway), and Gmail is no exception. I last used Gmail a bit over a year ago on Firefox, and it tended to start at about 60MB of explicit allocations, and work its way up to about 110MB. (Chrome being generally less memory-efficient than Firefox at present, I understand that figure to generally be two or three times as much.)

But a good email client doesn’t need to be like that; compare FastMail (which company I work for, but this aspect of the design and awareness of memory consumption happened long before I joined): the current explicit allocations on my two FastMail sessions are: 10MB for my work account (mail, open for several days and used plenty), and 27MB for my personal account (mail has been open for a few days and used plenty, and then I just opened calendar, contacts, notes, files and settings, so that all the code for all of them is loaded and all their views initialised, and let it settle down from 53MB to 27MB).

A lot of these things come down to having people care about performance (time, memory or whatever axis you like). Having a large team often makes it harder to get right too.

Almost all news sites, even many blogs and should-be-very-bland web pages use more memory than FastMail.

That's what I believe too. Thing's are always harder to implement than you believe at first as a developer I know that. But even than the only explanation I can think of gmail's heaviness is not caring. In some ways it's even worse than a blog or news site which is often image heavy, required or not than can at least use up a lot of memory. Gmail on the other hand is not and it's something that is essentially meant to be opened for hours, gives a simple interface that suggests it would be light whereas taking up more memory than some bloated desktop client.

I would use FastMail's web interface full time if I could but I have different accounts on different providers and if I want to use them with a single UI, I have to use a regular desktop client.

Can you please convert your web interface into a generic mail user agent which works with all imap and smtp servers? This would be a much nicer solution than redirecting or fetching mails into a single account and imho your web interface feels snappier than MailMate on macOS and eMClient on Windows.

I recently switched to fastmail and was able to go from 3 pinned gmail tabs to 1 pinned fastmail tab handling all of my email.

It’s so fast and I really like what you guys are doing. Thanks!

I used the tool called ps_mem.py which measures both private memory and resident memory, at the moment with 50 tabs it took 4.5GB.

Those RAM was really fully taken, unlike the VSZ. With more TABs my 8GB system will start slow down, as swap kicks in.

Yes I used the suspender but disabled it, sometimes it causes issues for me. I now depend on OneTab to use my computer properly.

Also, for special TABS it can eat so much memory that my system essentially stops responding suddenly, which is really annoying as you never know when it will happen. Can Chrome limit certain bad behavior TABs especially when it starts to take up all the memories?

I know each Tab is a process so it will not crash the whole browser, but the memory usage should be better handled no matter what.

I'm eager for info too. But while we're waiting, I have a genuine, not snarky, question too: does this ever actually negatively impact people's use of their computer? I can't recall ever feeling like my browser having lots of tabs open has changed the experience. RAM and resource usage hasn't been on my mind in years.

Yes indeed.

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.

> I often end up having to hold down the power button for 5 seconds.

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.

This would, in some way, let me regain control. Most likely it will have killed the X11 server and dumped me to a text console login prompt. If not that, maybe a browser will be killed.

The end result is roughly as bad as just rebooting, so I might as well just reboot.

It typically kills the browser. Sure, it gets you the same result as rebooting if you only have a browser open, but it’s much faster =)

Not all heroes wear capes.

I don't think X11 has anything to do with this. You should set ulimit for the browsers.

The browser loads images into the X11 server. Those images consume memory in the X11 server process. That bloats the X11 server up to be many gigabytes.

There is no reasonable way to account for the memory.

As a tab-hoarding Firefox user on machines running X11 with 2-4GiB of RAM who has spent time investigating Firefox and Chrome memory usage issues, I am having a really hard time believing your claim. Right now on the machine I am typing on there are 38 tabs open in Firefox 58.0, uptime 15 days, Xorg is taking up only 66088 KiB (66 MB) resident memory total.

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.

I use top. I run top, and it shows that the X11 server is gigabytes in size. Now what? Nothing tells me which X11 client windows are at fault. I can't tell if the memory is even legitimately in use; it could be a leak.

Your 66 MB is really low. Maybe your video driver is better than mine.

Why don't you stop opening so many tabs. People complain about memory usage by chrome and other browsers but at the same time they are the ones that are using tabs as bookmarks instead of actually using bookmarks. 100tabs open out which 50 they will probably never go back to.

I don’t use my tabs as bookmarks. I use them as tabs, to switch between and to have open, to group into windows. It works very well.

Why haven't you switched to wayland yet?

My laptop (2014 MacBook Air) only has 4GB of RAM. Most of the time it’s usually fine with Chrome, Spotify, Slack, a Terminal, Rails, Webpack and Neovim (with ALE, so another Node process running). However I have to keep the number of tabs open to a minimum, if I have more than 20 it just grinds to a halt. And restarting Chrome usually involves waiting for a few minutes for everything to load up. Starting Docker or Sketch is also painful.

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.

Sure. I have this issue and I assume others do to, based on the success of the browser extensions that auto-sleep tabs.

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.

Surely my PC usage behaviours are hiding this from me, then.

I sometimes run into the issue when I'm working on my addons for World of Warcraft. I'll frequently have 2 instances of the game open (~4gb of RAM each) + my editor + whatever else I havn't bothered to close and a ton of chrome tabs. Typcially those extra things are pdf documents, skype, qbittorrent and others I can't recall at the moment. I hit my cap of 16gb RAM pretty consistently.

My laptop has 8 GB of memory and I have to make sure to have no more than 4 or 5 Chrome tabs open when I use a VM.

You might instead use:


Yes, absolutely. I've had Chrome tabs take an inordinate amount of RAM and CPU and make the fans spin up. Enough so that other things were slow.

> inordinate amount of RAM and CPU and make the fans spin up

I 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.

Chrome needs to handle a malicious web site. Chrome thus gets the blame when it fails to enforce proper resource limits.

I find that a long-running Chrome instance will often start using huge amount of CPU time for no good reason (the Chrome task manager currently reports the "Browser" task is using 110% CPU and has used over 18hrs CPU time for my current instance). I've observed this on three different machines, one of which isn't used by me so there shouldn't be too much overlap in terms of sites used etc.

Yes, I have a noisy fan and if the browser makes it turn on it's distracting.

Indeed, "free memory" is the biggest waste of money and energy imaginable. Unless you lack the memory necessary to do something else, you shouldn't care.

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.

Unless you lack the memory necessary to do something else, you shouldn't care.

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.

Applications should use all available RAM they practically can for things like cache. Ideally they will hold on to it lightly so other applications can take what they need.

Entirely unused RAM is a waste if never used.

This is built into any operating system. If an application frees up memory, the OS doesn't throw that data out, it just marks it as "can be overwritten" and ensures that it actually can be overwritten without data loss (so, if the data in RAM has been changed, it writes back these changes to the hard drive).

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.

The OS should use all available RAM it practically can for things like cache.

Not the applications.

That may not actually be a practical approach to the problem. Years (and jobs) ago, we rolled significant caching into Vegas (video editor), allowing the app to take up 8GB of RAM in cached frames, even on 32-bit builds. There was no way for the OS to do this sort of work for us. The best that the operating system would have been able to do would have been to cache file reads for us.

Caching the output of computation was incredibly valuable to our customers, and the caching that the OS would have done would have had little to no benefit to our customers.

The same could be said for Chrome. Maybe there is value to a globally coordinated OS caching manager, but the OS shouldn't have sole responsibility for caching. Such an approach is clearly suboptimal for the user in at least one use-case (see example above).

There are exceptions, but in almost all cases, an application hacking the OS' RAM management is slowing down other applications disproportionally in order to make itself seem faster.

Shaming such RAM hogging applications is not just legitimate, it's very much necessary. Otherwise all applications would just reserve as much RAM as they can convince the OS to give them, even if they have no real use for it. There is no checks for this in place, so users need to understand the technical implications and punish RAM hoggers by avoiding them.

If your application can utilize RAM to disproportionally speed itself up and therefore on average speed up the workflow of most users, then that's legitimate, too, and an informed user will see the value.

You're talking about a professional software suite meant to work on workstations often solely meant to run that suite.

Chrome has to cooperatively share resources with other applications and with aggressive caching at application level, the only strategy at hands of the OS is to start swapping.

I'm responding to the assertion: "The OS should use all available RAM it practically can for things like cache. Not the applications."

Applied absolutely, it results in deeply sub-optimal behavior in a large number of cases.

Another case could be image decode caching via glide for scrolling lists, or skia output tile caching in a browser, or texture caching in a game engine, or reference frame caching in a video decoder, or glyph caching in a word processor, or block caching in a constructive solid modeller, or result caching in a spreadsheet, or composition caching in a presentation tool, etc. etc. etc.

Caching is an enormously effective tool for applications and operating systems. If an operating system removed it as a tool for applications, it wouldn't likely be a competitive operating system.

Should applications abusively and single-mindedly monopolize memory usage? In some cases, maybe. In general, I think we'd tend to be on the same side of things. I like to see well-behaved applications (that make conservative and efficient use of system resources) and robustly managed operating systems (that don't let apps walk all over them).

IIRC chrome actively adjusts its memory usage based on available memory.

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.

> Unless you lack the memory necessary to do something else

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.

AFAIK, each tab in Chrome is a new process, rather than a thread. It's a lot easier to waste memory on duplicate stuff. The operating system will try to re-use as much memory as it can, but that's just a conservative guessing game.

I just opened 'example.com' 6 times in new tabs, and mapped out the memory of the new processes. Total memory size: 10GB. Resident set size: 427.28 MB. Private dirty rss: 104.23 MB. I did the same thing with two new pages & processes just to make sure: 3.3450 GB, 144.532 GB, 36.876 MB.

example.com is a tiny html page. So, yeah, I don't know what the hell it's doing with all that memory. I don't think the devs care how much memory they're using.

To my overly long TODO-list I added a web browser project. I would like to see something akin to Links [0] or Lynx [1] with a bit of Dillo [2], but also for mobile.

Features & non-features:

- it would generally work like the reader mode (no other modes) trying to place navigation links in a predictable place

- user can easily select text size and color schemes

- night mode (Android does not have one)

- because of it's content focus it could offer great offline capabilities like full-text search through archive and version comparison

- probably ignore most or all CSS

- probably no JavaScript support

- ad blocker for the rest

Can such a thing use it's own rendering engine on iOS? As I said I don't care about JS.

[0] https://en.wikipedia.org/wiki/Links_(web_browser)

[1] https://en.wikipedia.org/wiki/Lynx_(web_browser)

[2] https://en.wikipedia.org/wiki/Dillo

What's the use of night mode? Even if someone needs to browse web in the darkness (which is a bad idea anyway), it should be implemented somewhere in the OS, not in applications.

Sometimes you need to browse in the darkness. It should be implemented in the OS, but it isn't. I don't have a mobile OS on my TODO list.

The night mode would be just a small additional setting on top of a color scheme selection.

If it's not implemented in the OS, wouldn't it make more sense to create an OS-level utility?

OS-level utility needs APIs that are not there in case of Android. All night-mode apps for Android are just a reddish overlay. It often falls apart when you something can't go through the overlay like AFAIR system passwords. I tried to use apps, but met with this wall several times.

Android did have a night mode, but it was experimental and removed in later versions. So other than alternative ROMs there's nothing there.

My 1st gen Pixel XL has had night mode since I bought it 1.5 years ago, and it has continued to work all the way to Android 8.1.0.

it is implemented in android, iirc

At this point it's probably easier to come up with an efficient HTTP/HTML/CSS/JS replacement plus matching browser than to write a complete browser from scratch.

You might find Min to your liking.


I've been kicking around some related ideas:


Try TidyTab, https://github.com/eggplanetio/tidytab. Added benefits are it's a lot lighter and you get to sync your bookmarks across your devices. I was a longtime OneTab user and I suggested several features to the developer to make it just about the same feature wise for anyone migrating.

Memory usage of a browser mostly depends on the web page. Compare a static web page with a JavaScript heavy web page that creates thousands of objects.

It's pure madness. Still in 2012/13, Google maps operated on a 32MB RAM system (with desktop recording running in the background). https://drive.google.com/file/d/1xq4w2LD9ypv1zwv6oqPTciWvIDD...

There are several answers here:

- Is 100 MB the marginal memory cost to add one more tab when you already have a bunch open, or is it the memory usage when you have a single tab open? Don't forget that there is a baseline amount of memory usage for the application itself.

- Measuring memory usage is hard, doubly so for web browsers. You'd think it would just be about counting all the allocations, but shared libraries, sandboxes, and cache make it complicated. Just looking at the "memory usage" panels in Windows/macOS is often misleading: unfortunately I can't find the link at the moment, but there's a great article about how for Chrome, the number you get in those panels is wrong.

- In response to the increasing demands of web standards, browsers have basically become mini-operating systems, and you'd expect them to have memory usage to match.

- Websites are complicated: DOMs get bigger all the time, and it takes memory to store them, especially with the aggressive optimizations browsers use (see next point)

- Browsers use a lot of techniques to maximize performance as much as possible: aggressive caching and JS engines that favor space-time tradeoffs for faster execution being the two big ones. But remember that these are all a question of degree: if there is less memory available, they will use less and just go slower. The browser is just using the RAM available.

tl;dr: you may not be measuring it correctly, it's a difficult problem space, browsers deliberately use as much memory as is available to optimize for speed

>- In response to the increasing demands of web standards, browsers have basically become mini-operating systems, and you'd expect them to have memory usage to match.

Allow me to partially disagree, it is true that browsers have basically become mini-operating systems, but not (IMHO) because of "increasing demands of web standards", because of "increasing demand of web publishers and all the crap that every other site has now embedded or is serving to you or is using to track this or that aspect of your visit".

A good question for the OP could be, how much memory does your Chrome use per tab if you disable javascript and open - say - 20 Hacker News pages?

use the tool ps_mem.py which tells you both the 'private' memory and the 'resident' memory chrome used, those memory are indeed taken, not just malloc-ed in a VSZ area waiting to be used.

When I ran an Ubuntu desktop, I ran Chrome in a container in order to limit its memory use.

(I now run Chrome in a Ubuntu VM under bhyve on FreeBSD, which has the same memory limiting effect, plus giving me U2F support when I pass a USB controller through to the VM)

It's rather obvious that chrome isn't intended for heavy duty as the tab bar becoming unusable above ~20 tabs. So I use multiple windows instead and max out 8 gb pretty quickly. I'm just glad it backs up dynamic content like edited form fields before those tabs get crashed to free up space. Also, it's quick to reach 7.9 gb, but goes a long way on that last ~100 mb. But of course a long running js leaking memory on some news site can bring it down.

Two times in a month the login manager crashed and I couldn't get back in from lock screen without killing a few processes manually on console. I'm going back to Firefox with noscript and tree style tabs, as soon as I finished working on all those open tabs ... so, probably never. I don't want to miss the history search and security of chromium.

So I should learn to use the history sidebar instead of tree tabs, and use the tab bar like a ring buffer, not a stack. And I should try deactivating js globaly, if there is a whitelist built-in.

Well, here is one thing I observed.

Chrome allocates different process for every tab. Firefox doesn't do that. Just one process for all tab.

Suppose I open 10 tabs each on Chrome & Firefox. And suppose every tab needs 100MB of memory.

If you look up in task manager -

Chrome - 10 tabs - 10 different process - 100MB each = 1000MB = roughly 1GB

Firefox - 10 tabs - only 1 process - 1000MB = roughly 1GB for that one process.

Sounds like your Firefox version is out of date. Multi process Firefox has landed quite a while ago, with different memory and performance characteristics.

I'll check.

Guess Firefox copied this feature from Chrome.

Fortunately they didn't : they use one process for the browser UI, and a few (like two or four) processes for tabs which are dispatched between those process. It's way better than Chrome in term of memory consumption when you have lots of tabs opened.

I think, the number of processes (by default) is set to how many cores you have on your CPU. That way you can achieve almost the maximum of parallelism with a minimum of RAM use.

You don't have to guess - https://wiki.mozilla.org/Quantum

Currently I have ~90 tabs open in Firefox. It uses 3.3GB of RAM and 1-3% of CPU (on a i7 though).

Closing and reopening is faster than doing the same in Chrome with far less tabs open.

IMO it's they usual software cycle of bloat -> optimization -> new features -> bloat -> optimization...

Try checking memory of a cryptocurrency exchange. A couple gigs after some hours of activity. I would imagine that there's a memory leak, but it's weird that this performance is consistent across all 3-4 exchanges I've been using.

I use Opera as my primary browser because Chrome is slow, a memory hog and makes the fans on my macbook air really noisy

At the core, Opera is still Chromium. Either way I use it primarily too, certainly snappier than Chrome itself

I'm aware it is core Chromium but it seems to run way faster...

Some lightweight browsers to try: dillo, midori, epiphany.

Also, ps_mem can be good for tracking what is using up your memory: https://github.com/pixelb/ps_mem

In large part, I suspect, chromes resource use stems from google wanting to scour everything you do. I wouldn’t be surprised to find out it logs how many seconds your cursor is over ads and all other user input.

Yes, it is a design fault.

What is design fault? Could you elaborate

The OP described the current design:

>with say 30 tabs open, 3+ GB is gone, chrome is such a dominant memory consumer! in fact it takes about 10X more memory than everything else combined

The last words in OP's post were "is this a design fault?"


I can't find the link, but there was something recently about how size of the js runtime has increased over time as all the new (es6) features have been added

Well, it's not a priority for them. Pick a browser that prioritizes performance for web browsing instead of running JS web apps.

Not a direct answer to your question, but 'the great suspender' extension puts unused tabs to sleep.

Yesterday I had to restart chromium on my computer, because it ate all 32GiB of RAM.

Only 100? Consider yourself lucky!

I know, I'm sitting at 2.2GB on mac with 4 open tabs.

well, using the current fad terminology: it is because every tab is a Native App. (i.e. an electron app -- i.e. a web page)

Hey. Hey.

Chrome tabs are processes with shared memory, but they're still processes. On Linux, they get kernel space mapped in. That influences their total footprint even though it's shared.

Can people just use what amounts of trifiling amounts of RAM in 2012 and stop demanding every executable be as "efficient" by an antiquated pre virtual memory metric, please?

Chrome is astonishingly good at what it does.

I don't need every application to be the leanest that it can be. What I need is for every application stop assuming that 12 GB of free memory means that it's their 12 GB.

I understand the adage of free memory being wasted memory, but there's a context for that adage. E.g. if a user clicks off of a tab, the browser doesn't need to write that tab's contents to disk when 12 GB is free. A good trade off is to store the tab in memory, for X minutes. Write the tab (or more simply, the URL) to disk after those X minutes have elapsed.

Free memory isn't wasted memory though, it's file system cache memory ! If a software uses 100% of the available RAM, it means all your file system call are going to be hard drive IOs (not everybody has ssd mate).

If you actually cared about this you provision a ramdisk. But this is a talking point, not an actual argument.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact