Firefox using lots of memory? Adblock Plus may be the reason
Mozilla has improved Firefox's memory usage significantly in recent time. Many Internet users still think that Firefox is using a lot of memory, but if you compare actual memory usage between different browsers, you will notice that Firefox's memory handling is excellent.
That does not mean that you may not see spikes in memory usage even if you open the same websites as someone else. One of the reasons for this discrepancy in memory usage are add-ons.
While many add-ons are memory efficient, others may increase the memory usage by a lot.
Mozilla recently analyzed memory usage of a version of Firefox without add-ons installed, and a version with the most popular add-on Adblock Plus installed.
The difference is significant, especially under the right circumstances. Adblock Plus adds an overhead to Firefox's memory usage of about 60-70 Megabyte. While that may be a lot depending on the installed memory on the computer, the difference can widen quickly under certain circumstances.
For every iframe that gets loaded in the browser, four additional Megabytes are added to the browser's memory usage. That does not appear to be much, but if you consider that some sites may make use of many iframes, it can grow quickly.
On the popular tech news site Techcunch for example, RAM usage more than doubles if the iframes on the website are activated.
The VIM Color Scheme Test page is an extreme example. Without Adblock Plus installed, Firefox uses about 370 Megabytes when the page is loaded. With Adblock Plus, that memory usage increases to almost 2000 Megabyte.
Note: The test results of my own unscientific tests are the following: 188 Megybte and 300 Megabyte without Adblock Plus installed to 340 Megabyte and 1160 Megabyte respectively with it installed.
The main issue here is that the stylesheet that Adblock Plus uses for its functionality is loaded for each iFrame. If you are subscribed to Easylist or another large list, then this is the reason why the extension uses this much memory compared to vanilla Firefox installations.
Some users have created their own custom lists to reduce it by a large margin, but that is probably not a solution that most users are willed to consider as it takes some time to implement.
A bug has been filed on Bugzilla about Adblock Plus' high memory usage. It offers additional insight into why the memory usage goes up by that much under certain circumstances. There does not seem to be a solution though for that issue at the moment, other than creating and using custom filter lists exclusively that use less information and are therefore considerably smaller in size.
I’ve heard this uses more CPU instead of memory. So it’s a bit of a trade off if that’s the case.
Bluhell blocks an interesting site on this network: outlook.com.
I’ve also noticed that adblock can reduce the framerate of flash videos for me. Perhaps my computer is slow, but I tried disabling (in addons manager) my own adblock and got smoother video from youtube. Disabling flash and switching to html5 video is even better and it seems unaffected by adblock.
Your conclusions aren’t off the mark. Unfortunately the memory footprint seems to grow by the hour. If I use firefox, it must be shutdown and restarted with regularity because of adblock.
@Sades – Going to try Bluhell, I hadn’t seen it before.
Have used adblock plus for many years and noticed that recently my surfing was slow plus firefox was slow to start first thing. So i fully uninstalled ABP and tried Adblock Edge but had the same problem, both used easylist and fanboys annoyance list by the way, but later found that i had unticked iframe box in NoScript ( i could not read youtube comments with it on) allowing NoScript to block iframes seems to help a little about 30MB, with startup a little faster on my homepage.
I found that AdBlock plus was rather a problem on old XP machines with limited memory.
Now don’t get me wrong I LOVE AdBlock Plus but some of my customers could not afford a memory update so I searched for a solution. I tried several cut down versions of AdBlock but eventually settled for BlueHell Firewall which is not quite as good as AdBlock Plus, but good enough at blocking adverts, and it uses far less memory.
Some of you may already have this but for those that don’t:
From the add-on page:
“About this Add-on
about:addons-memory provides an experimental about: page for advanced users to display some memory usage statistics about their add-ons.
To use, open about:addons-memory in a new tab.”
ABP = 13.56 MB usage, 17.5% addons, 3.4% (explicit)
Its listed at numero duo (after FF itself), and that’s out of some 80 or so addons loaded. Next highest are
– DoNotTrackMe : 3.91Mb
– Ghostery : 2.41Mb
– NoScript : 1.71Mb
Yeah, Adblock Plus uses a lot of memory because of subscription lists.
If you have the “Count filter hits” option in enabled in Adblock Plus, take a look at what rules actually get fired. In my case, the ones that get fired over and over again make up only 4% of the total rules in Easylist and EasyPrivacy.
I have always contemplated making my own subscription list based on that 4%, but the worry is missing future rules that may block other stuff.
Here’s a comment from one of the blog posts Martin linked to detailing how to remove all the excess rules from an Adblock subscription list:
This is something I might try in the future.
Well, I’ve been using AdBlock Plus (in this portable FF) since I set it up about 2 years ago – and I do not clean out extension data when “cleaning” .. and I sorted Easylist by hits .. and I’ve NEVER had any (although I did “reinstall it” (never removed it) the other day when testing Privacy Badger as I thought I has lost the toolbar icon, so that *may* have reset any counts). I actually have the setting for show a placeholder enabled and I must say, I’ve never seen one of those either.
I guess I nail everything before it gets thru to my browser (local proxy: privoxy) and if it gets past that, then RequestPolicy would kill it dead if it was third party – and then perhaps other extensions block it before AdBlock Plus (maybe NoScript gets there first?).
I didn’t delete any items as you suggested – instead I have disabled EasyList (but left the Popup BlockList and my own custom filter of 10 items). Results: FF newly opened went from 400mb with filter to 360mb without. It did indeed seem to open faster.
Interesting .. hmmm… as I was typing this I thought I would check something. I have a temperature monitoring in my system tray – and I know for a fact when I to Facebook, my machine makes more noise and my temp rises an extra 10 degrees. Without the EasyList filter – I just loaded FaceBook (my normal custom list landing page) and no noise, MUCH faster loading. Same for amazon – it would always takes a while to load eveything, machine would start being noisy (in my enclosed server cabinet) and the temps would jump 10 degrees. Now’s it as quiet as a mouse. Additionally my computer at “rest” is now 3 degrees cooler on average. Clearly, AdBlock Plus chews thru resources – appreciably slowing complex sites with many ads/wdigets/whatever such as amazon/FB.
I will leave EasyList disabled and while I will keep an eye out, I doubt I will see any difference in what lands in front of my eyeballs.
As for memory leaks – never seen them. I happily leave FF open for weeks at a time and would be lucky to have 2 crashes a year :)
Thanks Martin – you may have an extra dollop of ice cream tonight :)
^^^ Update: AdBlock Plus wipes all my filters hits on every shutdown/open of FF. I noticed one “ad” earlier on a site I visit every day (hence the “ad” stuck out). So I loaded the EasyList and voila it vanished and I had a hit. I loaded facebook, 8 more hits (“/hads-“). Closed/opened FF – all hits were back to zero.
Have since re-enabled EasyList. Never really had any problems with it anyway – but it’s interesting that I also have ABP in thunderbird and its also been incorporated into QuiteRSS – and they don’t have any problems either.
Just to confirm my theory, a user on the Adblock Plus forums trimmed down the rules on his subscription list to the bare minimum (rules that hit greater than 10 times) and memory usage decreased big time:
Granted, this was on ABP for Android, but same principle applies.
I use uBlock on Firefox and Chromium now, but just wanted to post this tidbit here.
I always found it laughable to see these people with 2+ huge adblock subscriptions turn around and complain about Firefox cpu/memory “leaks”.
Thank you dszady for the link to about:addons-memory works well, with simple layout of info even i can understand, cheers!
Okay, so I am still running that old, funky Firemin and Palemin software. No memory problems, and no CPU problems. Wondering why other are apparently not using it. Is it NSA spyware?
I’ve been using this awhile https://addons.mozilla.org/en-US/firefox/addon/freememory/
Not really, my Firefox with ABP and a lot of extensions installed use only 476Mb of memory.
What I’d like is a simple list that blocks Facebook and other social trackers, while letting me use the Facebook site if I want to. Ghostery was good, but there must be alternatives. Right now I have Disconnect which I find poor by comparison.
I cast ABP aside well over a year ago for Bluhell for being a GROSSLY HUGE memory hog. I realized this at the time when I ran the addon, about:memory-addons to prove this. To me, not being able to whitelist in Bluhell is not a big thing when you consider Bluhell is awesome for blocking YouTube and other video ads in addition to image ads.
I just download Flashblock from Firefox so severe that I can not play vedeo / youtube in firefox browser, totally useless
After such a comment, I think you would be better off deleting your RAM :)
Tried to post yesterday but the anti spam or something kept me out.
To rephrase what I said…
I think it would add more value if you compare Chrome loading the website with and without adblock so that people can benchmark if firefox memory management is still bad. As it looks, without another browser to benchmark against, the article seems to imply that the culprit is adblock.
It could be firefox’s management of extensions is poorly implemented or something.
I wonder if Adblock Edge (the Adblock without whitelist crap etc) is affected too. My FF consumes about 900mb at the moment, with about 30tabs open.
It is likely similar. I would check the example pages with the add-on enabled and disabled.
Yes, exactly the same sadly.
Adblock is guilty, but Flash plugin is a real enemy. Each tab with simple flash allocates additional 50MB. Tab with flash video allocates at least 100MB. And if you open pages with 10 Youtube videos in in, forget about it. It will take all the memory you have.
Also check other extensions. I found one really needed one that is also huge memory hog(probably conflicting with something else).
Ghostery does a reasonably good job of removing ads.
Too bad there aren’t any full alternatives.
> There does not seem to be a solution though for that issue at the moment
There is a solution: https://github.com/gorhill/httpswitchboard/wiki/Adblock-Plus-memory-consumption
I implemented it in HTTPSB. Works well. It would also work on Firefox, solution is not specific to Chromium.
Stupid question, but how does it work? What’s the connection with Adblock Plus? Does it replace adblock plus or it works with it?
By the way I only see “A Chromium browser extension[…]” without any reference to firefox. And I don’t see .xpi files in the dist folder. How is it connected to firefox?
> Stupid question, but how does it work?
It injects only the CSS rules which are going to be really used by the page, instead of injecting unconditionally all of them (20,000).
> What’s the connection with Adblock Plus?
> How is it connected to firefox?
Okay. How do I use it to block ads then?
I’d like to try this because I’ve been experiencing NUMEROUS Firefox crashes over the last month or so which I now suspect after reading this and similar articles are related to AdBlock Plus memory overconsumption, but I don’t know how to install the scripts into Firefox. Can you walk me through that?
It’s not AdBlock Plus. I removed the extension, restarted Firefox and everything looked fine, I was at about 465meg. Started browsing sites and about 3 hours later Firefox is using up 1.7gig of memory.
My extensions are TMP, LastPass, The Tracktor, BluHell Firewall, Search for Image by Google, Flash video downloader and Google translator.
Yes u r right there are many adblockers who are using a lot of memory. Its not just about the memory they are also killing the online advertisement business. so we have to find some way to beat those ad blockers. so i tried adzsafe.