Yes I use onetab extensions etc to save memory, just wondering why one tab takes so much memory, is this a design fault?
Ask HN: One tab on Chrome takes about 100MB memory, why?
1–10 of 210 posts
Re: Ask HN: One tab on Chrome takes about 100MB memory, why?
#2Re: Ask HN: One tab on Chrome takes about 100MB memory, why?
#3Re: Ask HN: One tab on Chrome takes about 100MB memory, why?
#4Two 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.
Re: Ask HN: One tab on Chrome takes about 100MB memory, why?
#5Re: Ask HN: One tab on Chrome takes about 100MB memory, why?
#6I'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.
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.
Re: Ask HN: One tab on Chrome takes about 100MB memory, why?
#7- 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
Re: Ask HN: One tab on Chrome takes about 100MB memory, why?
#8Re: Ask HN: One tab on Chrome takes about 100MB memory, why?
#9I'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.
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.
Re: Ask HN: One tab on Chrome takes about 100MB memory, why?
#10I'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.
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.