Yes I use onetab extensions etc to save memory, just wondering why one tab takes so much memory, is this a design fault?
> 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.
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.
EDIT: 164 856 kB w/o JS. So no change (relatively).
$ ldd chrome | wc -l
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.
Or is the process totally different?
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.
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.
<!-- yes, I know...wanna fight about it? -->
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 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.
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.
Common sense is still required (which is unfortunately very rare in the modern programming world).
(Seriously. Chromium is 124MB. How does anyone think web dev will go differently?)
Any example of where something like this is actually used?
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.
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.
An example from the late 90s might be the idea that people wanted intro animations and music on web sites, heh.
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.
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.
On the performance side, Hacker News still takes 100MB of memory in Chrome, so...
(clientside that is; serverside it would be dynamic but Chrome should not be bothered, it is, but that is another story)
In all seriousness, we need waaay fewer layers of dynamic abstraction than actually get employed to solve most problems.
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.
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.
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.
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...
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).
> I'm going to be quite upset...
You'll get over it, I promise.
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?
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'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.
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.
Google devs use 16-32 core machines, often with hundreds of gigabytes ram. Why would they bother optimizing?
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.
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 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.
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.
* 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..
these are gaming, most powerful PCs people are using. 8gb is 44% of all users.
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.
My understanding is that they have rMBP laptops and slightly beefier desktops.
> 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).
Because they're also targeting Android devices.
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.
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.
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.
What I'm missing here I'm honestly totally confused.
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.
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.
It’s so fast and I really like what you guys are doing. Thanks!
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.
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
> 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.
Your 66 MB is really low. Maybe your video driver is better than mine.
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.
I almost always find that this is caused by a badly behaved website, not Chrome itself.
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.
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).
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.
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.
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).
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.
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.
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
- 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.
The night mode would be just a small additional setting on top of a color scheme selection.
Android did have a night mode, but it was experimental and removed in later versions. So other than alternative ROMs there's nothing there.
- 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
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".
(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)
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.
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.
Guess Firefox copied this feature from Chrome.
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...
Also, ps_mem can be good for tracking what is using up your memory: https://github.com/pixelb/ps_mem
>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?"
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 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.