Why do web browsers use up so much memory?

hedron

Limp Gawd
Joined
Apr 24, 2008
Messages
495
I had firefox open with only three pages and it took up 500MBs of RAM?! What gives?

I remember way way back in the day surfing the internet with Internet Explorer 5 with a 96MB RAM/225MHz PowerPC Mac and I had no problems. Of course, I didn't typically have as many webpages open at a time, but I had 3 opened occasionally. Yea, I was using 28kbps dail up, but still, today's pages are larger, but they're not 500MBs larger.

Right now, I have firefox with three pages, Zerohedge, Hardform and another bulletin board forum website similar to this and Firefox is using 900MBs of RAM? Why?

I have some serious business applications that calculate large volumes of data and they don't take up 1GB of RAM unless I'm doing something that involves heavy calculations. This is just mindboggling to me. I thought through time that software programs would become more efficient, but I guess browser programmers don't really care much about optimization for RAM size.
 
Not only has the HTML spec become a lot more complicated but web pages also have far more scripts, flash, etc on them these days. Javascript engines have also increased a lot in size to improve performance. You can do amazing things with Javascript these days.

The browser will also cache previous pages in RAM for quicker access when you hit the back button.

If you're that concerned about using the RAM you paid for, you can always use a more compact browser.
 
The browser will also cache previous pages in RAM for quicker access when you hit the back button.

For what purpose? I already went to those pages and read them. I have no desire to go back to them. Why would anyone?

Yes, they've gotten more complex, but 900MBs is ridiculous. There is no rational reason three web pages should take up that much space.

I downloaded a website from the internet a few weeks ago and it was 200MBs total. Plus, I rarely see a webpage that is more than 100kb. Maybe you have? Which one? So, I really can't see the argument that it's because webpages are more complex. They certainly do not need to be.

Well, ok, this pages html is 60kb and scripts and images amount to ~400kb. I have 6 pages open and the browser is taking up 600MBs of RAM. Another page is 1.5MBs. Even if the other pages were 10MBs each it would still be no where near 600MBs.
 
Last edited:
I'm seeing serious memory leaks in Chrome. It's usually to do with the ads.
 
If you are like me I use a ton of plugins and ad blockers, yes this is what causes chrome to be such a RAM hog..
 
If you are like me I use a ton of plugins and ad blockers, yes this is what causes chrome to be such a RAM hog..

I can leave a webpage sitting there and watch the memory clock up. The only extensions I have are Lastpass, the OCUK shopping app, and Glove.
 
Each "tab" is its own individual process now also. It wasn't like that originally. This makes the browser more resilient to crashes, so any one tab isn't able to kill the entire browser. Although with Firefox when Flash crashes it seems to freeze the entire browser until you kill plugin-container.exe, then Firefox springs back to life like nothing happened.
 
Firefox now stores cached pages in memory rather than to disk. It's much faster reading/writing to memory than to disk. Even if you navigate away from a page it can still cache some data.

You wouldn't want them to start caching back to disk.
 
Browsers are very complex programs. Its not just the raw HTML that is taking up memory, the HTML is converted into a complex document structure; the DOM.

Each HTML element contains all of these attributes, and the browser has to be capable of regenerating the page layout on the fly in a timely manner. The page can modify the DOM completely, or modify the raw HTML of a single or multiple elements, causing it to be re-rendered.

Now add in parsing and executing Javascript, which has grown into a pretty robust language, and some large increases in page render time, and you have higher memory usage.

Each tab also caches quite a few pages in case you hit the back button. There is a setting somewhere in about:config to adjust how many.

Windows takes a lot more RAM these days than Windows 95 did, I guess we're going backwards?
 
What add-ons do you have enabled? That can make a huge difference as well.

AdBlock Plus, for example, has an automatic ~60MiB+ overhead, with an add'l ~4MiB per iframe on the page. (regardless of whether the iframe contains ads or not). More details on ABP here
 
Each "tab" is its own individual process now also. It wasn't like that originally.

That explains a little. I still don't see that as a factor for having 3 pages taking up 900MBs of RAM. IMO, a browser shouldn't take up much more space than 150 maybe 200MBs or so, if it's fully loaded with 10 or 20 pages.

I think part of the problem is that web browsers were originally designed to just deliver static content, but now they are vectors through which entire applications are run through. Which is very inefficient. For instance, instant messengers are stand alone applications. But you can run yahoo messenger in Yahoos email web portal. It might be convenient, but I don't see the efficiency.

I'm going to try to limit cache to 50MBs instead of the default and see what happens.
 
No, but I notice that memory doesn't leak on VBBS messageboards without ads.
I'm just wondering whether it's actually leaking or whether it's just extra data being pushed into the history cache.

I think part of the problem is that web browsers were originally designed to just deliver static content, but now they are vectors through which entire applications are run through. Which is very inefficient.
It can be, but not to the point where you should generally worry about it. It's certainly not the case that native applications will always perform faster and/or use fewer resources than a web browser running an app: it just depends. For some browsers, developers can actually build web apps using the same high-performance system language operating systems and the aircraft fly-by-wire systems are written in to achieve efficiency, and bypass complex DOM manipulation using the same high-performance rendering facilities you find in Android or iOS.

If you need something that's very high-performance or highly time-critical, you should generally look for a native app. But something like a messaging app is neither.
 
Last edited:
The more ram you have, the more can be used...it's not a bad thing. Why else did you buy it?
 
I'm just wondering whether it's actually leaking or whether it's just extra data being pushed into the history cache.

Definitely leaking: I can leave the page sitting there and watch the memory rise in Chrome's Task Manager.
 
Windows takes a lot more RAM these days than Windows 95 did, I guess we're going backwards?
Nah it's not that. If developers would friggin' stop adding new features then things wouldn't be so bad. After all, with every additional feature and function = increasing complexity = increasing vulnerabilities and insecurity & higher resource requirements.
 
OP: you're right to complain. This is largely just bloat. You can view complete HTML4.x/5 pages (minus flash ads) on smaller devices using a fraction of the memory desktop browsers use.

Some of the bloat is actually a good thing (keeping processes separate... for security and stability, availability of plug-ins, and preloading some components which may be used). Otherwise, it's just all sort of other things thrown in layer after layer (embedded/nested frames may each be complete browser environments themselves), without a care of memory efficiency at all.

In Chrome, hardforum is actually pretty small, at least compared to total system memory size. I see a 60MB memory footprint including 20MB shared (using Stats for nerds link in Chrome's task manager). The smallest page I have open (coursera.org) is only using 8MB total (including shared) and the largest (techcrunch) is using 230MB total (including shared, and unsurprisingly it's full of frames).
 
I don't mind Firefox using so much memory as much as I hate that it falls apart after a certain limit and becomes unusable.
 
Javascript is the main cause.

Only last week I been diagnosing this.

I will give some stats.

IE11 loaded with 58 tabs and javascript allowed. Left alone for 2 days idle.
CPU usage when IDLE - 40% insane. Memory usage 3.9gig
Then I locked down IE by disabling active scripting (javscript) and some other stuff on the internet zonem, made the trusted zone like how the internet zone is by default and moved things like youtube to the trusted zone. Now the same 58 tabs is.
CPU usage approx 1.5% o_O and ram about 600meg, still high in my opinion but a huge improvement, memory leaks almost stopped, the ram usage close to when tabs first loaded.

Firefox isnt quite so simple tho, this thing is coded badly and always leaks memory even with no javascript, but blocking javascript certianly slows down the leaks and makes it run about 4x as fast. Youtube uses a TON of memory tho, eg. if firefox is using 400meg of ram, I can load one SINGLE video and it will jump up to like 1.2gig, so playing a video on a web page needs 800meg of ram wtf? Close the page, and if lucky the memory is recovered, but quite often isnt, especially when the browser has been running a while.

Modern browsers now days need a powerful rig to run responsive, web browsing with javascript will stress my haswell and is heavier on resource than many games. Because browsers have essentially become an OS, they used for multimedia, gaming, apps etc. My old i5 750 was fine for games, I upgraded to haswell to speed up firefox ;)

So many sites now days abuse javscript, if you use something like noscript and check the domain list, often there is 20+ domains to load a single news page, trackers, widgets, twitter etc. all auto refreshing as well when its idle.

Not only that if you allow browsers to use GPU acceleration they often use signficiant amounts of vram, e.g. when I have IE set to use the GPU it will easily use up a gig or more of video memory.
 
Last edited:
Did you disable javascript with NoScript extension in Firefox?

FF is the worst browser when it comes to how it's coded, but I use it (Pale Moon, actually, can't stand new FF) because of its customization abilities. After some time it caps a single core @ 100% and becomes a lagfest. I have 30-50 tabs open in Opera on my old Android phone for days and it works like a charm. And I had to upgrade from 8 GB to 16 GB RAM to make my computer usable, all because of browsing. My games are less demanding, unbelievable.
 
yep I use noscript.

sadly firefox on a technical level is years behind

no sandboxing, no multi process architecture, no 64bit on windows the biggest platform, without extensions its probably the least secure browser as well as the worst in useability. What saves it is as you said the customisation and extension platform.

http://www.howtogeek.com/165264/heres-why-firefox-is-still-years-behind-google-chrome/

I will also soon be switching to palemoon, as I like his stance vs the horrible australis and its 64bit.

But I do also use IE11.
 
I've installed the HTTP Switchboard extension and blocking the scripts on Hardforum appears to have stopped the memory leak dead for this tab.
 
I don't think anything is saving Firefox. I think the majority of its user base is just dwindling as they slowly figure out that IE isn't bad anymore or chrome is a good alternative. It takes a long time for people to shake old habits. I remember when Firefox was big meeting people who were IE haters that were using Netscape still. lol. People just take a long time to move. Most people never cared that much about the customization anyway, what they cared about was things like built in spell check. Remember how long IE didn't have that before they leaped ahead?
 
On another forum I use, specifically stopping the Facebook and Twitter scripts has had a significant benefit.
 
As a web developer at my company, I've moved to using Javascript to generate more and more facets of the page. PHP just used for pretty much only the backend while I use AJAX to dynamically load the data on demand. Then, JS is used to generate pretty much all of the markup on the contents. This has some pretty big savings on server processing and is better for code separation in general. Think of it like the equivalent of torrents for server processing power, kinda. PHP just handles responding to AJAX calls and that's pretty much it. Pages are also generally more fluid when the user doesn't have to go back to them. The downside is that the experience depends more and more on the user's machine having the juice and whatnot. But I think it's reasonable. JS performs reasonably well, provided the designer is reasonable.

Now this is all on the intranet though. The difference with big, public pages is that they want you to do twitter and all of this other social media crap. Also whereas I hand code anything that isn't too complicated (ie JS charting, datatable markup, and fully capable code editor are a bit over the time I'm willing to spend, and I do use JQuery), they probably grab large libraries for any little thing. Then, factor in the ads which at this point have turned into an art of trying to get past your browser any way possible. I can't count the number of times I've had to open up adblock and write custom rules while looking through the element properties in the DOM Inspector because of some of the crap they pull.

It's not hard to utterly crash a browser using enough JS. There are a lot of advanced things going down the pipe.
Lately I've been playing around with D3 for graphing a Neo4J library. One of the more tame examples:
http://www.brightpointinc.com/interactive/political_influence/index.html?source=d3js
Out of:
https://github.com/mbostock/d3/wiki/Gallery
Try some of those, they're fun.


I don't think anything is saving Firefox. I think the majority of its user base is just dwindling as they slowly figure out that IE isn't bad anymore or chrome is a good alternative. It takes a long time for people to shake old habits. I remember when Firefox was big meeting people who were IE haters that were using Netscape still. lol. People just take a long time to move. Most people never cared that much about the customization anyway, what they cared about was things like built in spell check. Remember how long IE didn't have that before they leaped ahead?

I have no idea what you're talking about. The "old habit" is still IE. It always will be. If "most people" don't care about customization, why would alternative browsers be the "old habit"?

As for me, I recently stopped using Chrome even at work, despite its faster dom browser, because of the things about it that suck. Namely:
- I can't control how it's disabling Tampermonkey seemingly at will. Basically I have no control over extensions I'M EVEN FRIGGIN USING. Google does!
- It will suddenly kill tabs when you run out of RAM, rather than some slowdown or something. Just poof, they're gone. Or it just utterly kills itself in your face.
- Less customization options...
Finally, not work related, but:
- I remember I did a benchmark on Chrome at some point in the past (on home computer, which had more resources). I opened some 100-200 tabs. Chrome just bogged up and died eventually, because it's trying to spawn 200 processes. Firefox... and ESPECIALLY Waterfox... is extremely stable when having hundreds of tabs open. Yes it chews memory and eventually bogs down, but it won't crash. Well at least Waterfox doesn't.

So while it's okay and I do like its fast and easy to use DOM browser, Chrome has its downsides, and IE is still annoying for me to code for. Even versions 10+ do crap that I don't expect them to as a developer compared to very other modern browser. Plus they lack all of the addons that I desire.
 
Back
Top