Live data from Hacker News

Ask HN: One tab on Chrome takes about 100MB memory, why?

news.ycombinator.com

161–170 of 210 posts

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#161

Earlier quoted context omitted.

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…

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 utopi…

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.

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#162

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…

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

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#163

Earlier quoted context omitted.

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

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#164

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…

>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-po…

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.

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#165
post #64

Earlier quoted context omitted.

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…

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.

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#166
post #34

Earlier quoted context omitted.

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.

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.

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#167
post #87

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'…

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.

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#168
post #163

Earlier quoted context omitted.

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.

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#169

Earlier quoted context omitted.

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

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?

Re: Ask HN: One tab on Chrome takes about 100MB memory, why?

#170
post #14

Earlier quoted context omitted.

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?

>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.
Post reply on HN