Tuesday, December 06, 2011

How Google is quietly killing Firefox

After a certain period of time spent programming, you develop a kind of sixth sense about what programs are doing. Surprisingly often, this sixth sense turns out to be right. I don't know if what I'm about to say is right. I do know that my sixth sense is telling me something.

I've been a Firefox user for years, and I still like Firefox, the way I still like my 1998 Jeep Grand Cherokee (with the cast-iron six-cylinder engine) even though it's not the latest-and-greatest model. Lately, though, Firefox has been freezing and/or quitting unexpectedly with greater and greater frequency, even though my browsing habits haven't changed.

What's changed over the past couple of years? The Web. Web content has become more and more dynamic, more AJAX-driven, more JavaScript-intensive.

JavaScript is a great language, but like a lot of languages these days it relies on programmers being careful about how they manage runtime objects. It's surprisingly easy, if you manipulate the DOM a lot, to generate code that leaks memory. See this nice writeup for more info (also see https://developer.mozilla.org/en/Debugging_memory_leaks).

My contention is that most AJAX code leaks memory like a sieve, and this is why more and more users are seeing their browsers (not just Firefox, but IE, Safari, and Chrome as well) freeze up and die in normal operation these days. The various browsers differ in how they manage memory and how they do garbage collection. Chrome, in particular, has undergone significant changes recently in how it handles garbage collection. This is no accident. It's in response to the greater challenges imposed on all browsers today by dynamic web pages.

When I leave AJAX-intensive web pages open all day in Firefox, I eventually find that Firefox is using 1.3 gigabytes or more of RAM. Usually, by the time it reaches 1.4 gigabytes, the browser freezes (goes white) and then either dies outright, or unfreezes again after 30 or 40 seconds. If it manages to unfreeze, usually about 60 megabytes of RAM have been freed up (according to Task Manager). But then memory usage marches upwards again and it freezes (goes white) again, within seconds. The freeze/unfreeze cycle continues until Firefox unceremoniously crashes.

My programmer's sixth sense tells me that when memory usage exceeds a certain level, Firefox lacks sufficient headroom to carry out a proper garbage collection cycle. Partway through the cycle, it runs out of memory and initiates another GC cycle. This repeats until the program is in what one might call a GC panic. Uncommanded program termination is the inevitable result.

Firefox is often roundly criticized for its tendency to "leak memory," but I would caution that it is not really the core program that is leaking memory. It's really the AJAX code running in JavaScript-intensive pages that's causing the memory leakage.

So ironically, Firefox's reputation is suffering not because of anything Mozilla's programmers are doing, but because of web developers who are using jQuery and tons of other popular libraries indiscriminately, without regard to memory leakage. (Be sure to have a look at this blog post about jQuery's role in memory leakage.)

I haven't done careful testing, but I can tell you (from daily experience) that if I leave Gmail open in Firefox all night, Firefox will run out of memory by morning. If I leave Facebook and Twitter open as well, I can count on running out of memory in just a few hours.

Now here's where it starts to get really troubling.

Mozilla's greatest revenue source today (accounting for more than 80 percent of annual income) is Google. Mozilla is deeply dependent on Google for operating revenue. And yet, it is in direct competition with Google for browser market-share. Recently, the Firefox and Chrome adoption curves crossed, with Firefox now lagging behind Chrome for the first time.

There's a huge conflict of interest here. If you buy the theory that most people who abandon Firefox do so because it crashes (runs out of memory) unpredictably, it stands to reason that all Google has to do to pick up market share in the browser world is publish AJAX-intensive web pages (Google Search, Gmail, Google Maps, etc.) of a kind that Firefox's garbage-collection algorithms choke on — and in the meantime, improve Chrome's own GC algorithms to better handle just those sorts of pages.

That's exactly what seems to be going on. Or at least that's what my gut says.

And my gut is sometimes right.


  1. Anonymous11:03 PM

    i am leving forefox because google has help steal my info and i will not use google and firefox is going to make it the main set so good by firefox

    1. Anonymous1:33 AM

      Well said.

    2. Anonymous5:23 PM

      I couldn't agree more

    3. Anonymous12:08 AM

      Lol are you guys serious? That was incredibly poorly said. I can't even understand whether he's advocating "forefox" or chrome!

    4. Anonymous11:02 PM

      Well done!!

  2. Anonymous3:23 PM

    It's sad, but true that google is intentionally slowing down Firefox on their products. Firefox runs fine even if i leave it on for days, until i pop out google calendars or gmail of course. Within an hour, Firefox's performance becomes unbearable.

    I have "somewhat" fixed this by using Chrome for gmail and Firefox for anything else. I have become a master of shortcuts, switching between the two browsers.

  3. Anonymous11:00 AM

    Well, your sixth sense is right. My firefox crashes only using google maps. Firefox runs smooth, otherwise.

    1. Anonymous9:12 PM

      The same is true in my case. It's sad. Google Chrome is so deeply stealing the privacy of its users and that's why I don't want to use it. But Google is killing Firefox.

  4. Anonymous11:38 AM

    Yes, Gmail is currently running all kinds of scripts that are causing Firefox to hang up. I believe it is deliberate to force us to use the Chrome browser for their apps. However, as Google continues to not follow W3C standards, they are following the practices of Internet Exploder in which only their own browser is friendly to their apps and pages.

  5. Exactly. Google sites- non browser- either freeze or close to that. My own blog is unavailable to me on Mozilla after working fine for a year ..freezes solid now. A little better on Chrome. But I did notice...when Chrome gets a bug..it effects Mozilla.Twice when I hit the Chrome icon,Mozilla began to load also. I had to do a system restore to LONG ago- lol,to get back to near normal on Mozilla.

  6. Anonymous6:48 PM

    This comment has been removed by a blog administrator.

  7. Firefox is a great, free browser. But you can make it even better and more versatile by adding Extensions. This article explains what Extensions are, suggests four Extensions you might want to add to your browser, and describes the installation process. Search Bar Firefox 57 Quantum addon

  8. Our essay Research Writing Service in the mission to ensure clients are satisfied has ensured access to customer service 24/7 meant to address all issues relating to custom term papers and Buy Essay Writing Service offered by the company.

  9. Such a nice blog Thanks for sharing information Firefox keeps crashing

  10. Looking great and it is very helpful content you can read my content here It is really helpful article please read it too my blog FIREFOX KEEPS CRASHING.

  11. Thanks for sharing such a good content with your blogs. I really enjoying your blog while reading. if you need any kind of information FIREFOX KEEPS CRASHING.


  12. شركة نقل عفش
    اهم شركات مكافحة حشرات بالخبر كذلك معرض اهم شركة مكافحة حشرات بالدمام والخبر والجبيل والخبر والاحساء والقطيف كذلك شركة رش حشرات بالدمام ومكافحة الحشرات بالخبر
    شركة مكافحة حشرات بالدمام
    شركة تنظيف خزانات بجدة الجوهرة من افضل شركات تنظيف الخزانات بجدة حيث ان تنظيف خزانات بجدة يحتاج الى مهارة فى كيفية غسيل وتنظيف الخزانات الكبيرة والصغيرة بجدة على ايدى متخصصين فى تنظيف الخزانات بجدة
    شركة تنظيف خزانات بجدة
    شركة كشف تسربات المياه بالدمام
    شركة نقل عفش واثاث

  13. Packers and Movers Bangalore - Reliable and Verified Household Shifting Service Providers Give Reasonable ###Packers and Movers Charges. Cheap and Best Office Relocation Compare Quotation for Assurance for Local and Domestic House Shifting and Get estimates today to save upto 20%, ***Read Customer Reviews - @ Packers And Movers Bangalore


Add a comment. Registration required because trolls.