
Firefox finally plugs the leak - pbiggar
http://blog.mozilla.org/nnethercote/2012/05/07/update-on-leaky-add-ons/
======
AndrewDucker
Well, plugs _a_ leak. The Memshrink team has plugged an awful lot of leaks,
and slimmed down an awful lot of code over the last year or so.

They've now hit the point where they're largely fixing bugs in add-on writer's
code, rather than their own.

~~~
rrreese
This sounds great, I stopped using Firefox just over a year ago due to its
fairly heavy memory usage. I usually run with 20+ tabs and even on a machine
with 4GB of ram it was pretty unpleasant.

How are you current Firefox users finding the RAM usage, especially compared
to Chrome?

~~~
robin_reala
I’ve just killed and restarted Firefox, then duped my current set of tabs over
to Chrome (in-house jukebox using websockets, a slideshare presentation,
couple of open Google Docs spreadsheets, a Pivotal tracker session, a couple
of tabs of a local development project, Google Plus, and this HN thread).
Totalling up ‘Real mem’ in Activity Monitor shows Chrome 18 using 735.4mb (of
which 33mb is Flash). Firefox 13 (beta release to be fair) is coming in at
450mb (of which 65mb is Flash).

The internal memory measurements (about:memory) come out as 835mb resident for
Chrome, and 324mb (of ‘explicit’, whatever that is) for Firefox.

I’m not using any extensions in Chrome. In Firefox I’ve got installed Firebug,
FireFontFamily, FireQuery, Lastpass, PDF.js and QuickJava.

 _Edit: oops, missed cloning a tab with a video in over to Chrome. That
explains the disparity in Flash, and you could probably expect to increase
Chrome’s real mem usage a little had I not closed it already…_

~~~
keeperofdakeys
With Firebug installed, you most likely have JIT disabled
[http://antennasoft.net/robcee/2009/12/15/firebug-and-the-
jit...](http://antennasoft.net/robcee/2009/12/15/firebug-and-the-jit/). I
would suggest you use a separate 'webdev' profile for such things (the inbuilt
web console that is now in firefox is also getting there).

~~~
robin_reala
That was true in 2009 but was fixed in January 2010:
<https://bugzilla.mozilla.org/show_bug.cgi?id=534120#c52> (although it’s true
that if you’re actively debugging scripts the JIT turns off - Firebug has the
script panel off by default)

------
srean
This is great news and may finally push me into upgrading FF on my depleted
box. Despite all the grumblings about FF's memory issues, it is the (only)
full featured browser that works for me, not Chrome.

There are a few reasons for that. (1) There's no tab abuser worse than me. I
have hundreds of them around (I have commented before, why I have it that way)
(2) I do all my browsing from a (battery less) laptop with 512 MB of RAM. (3)
I do not close my browser for months on end. On top of that I expect that I
should be able to do my usual editing etc while I have the browser open.

For this very corner'est of corner cases, if I use Chrome, my box goes into a
fetal position and dies. However, and kudos to FF 3.6, (yeah 3.6!) my laptop
works great, no problem at all. I have flashblock, no script, bar-tab, memory
fox, bunch of greasemonkey scripts (to fix google's layout, and give github
and bitbucket a dark theme) and have tweaked FF's cache settings.

On a more performant box I am on FF-11, but have never upgraded on the other,
fearing that the new FF assumes (not unreasonably) the box to have more
memory.

~~~
FreeFull
How bad of a tab abuser are you? I can easily reach over 450 tabs. It helps
that since Firefox 4, there is an option that doesn't load all tabs when you
start Firefox up, but instead only loads the tabs as you switch to them. Tabs
that haven't been loaded don't seem to have much footprint at all, so I tend
to build up rather a lot of them.

~~~
Herring
How do you guys manage your tabs? I have ~100 and I sometimes feel like I'm
drowning. That option you mentioned really helps.

~~~
skeletonjelly
Have you used the tab grouping feature?

~~~
Herring
I use Tree Style Tabs. I think it's better than tab grouping.

------
btipling
On Sunday, using my latest version of Firefox, I opened a single page loading
it only once to check how it looked in Firefox. Then I forgot I had Firefox
open for the rest of the day. Eventually my Macbook Pro became slow and
looking at Activity Monitor I saw Firefox was taken hundreds of MB of RAM and
just eating some 20-30% of CPU% just idling there.

Every time, Mozilla devs claim all the bad bugs will be fixed in the next
version. I heard it for v2, for 2.5, 3, and 3.5 and now of course whatever
crazy version number Firefox is on now. It still sucks, but now I don't care
any more because now I have Chrome.

~~~
rpearl
Every time I use Chrome, my Macbook Pro becomes slow and everything pages to
disk. It's snappy when it starts, but in Chrome 20 or whatever crazy version
number they're on now, there's still a lot of leaks. It's very frustrating.

But for some reason everyone has the impression that Chrome is both fast and
uses less memory than Firefox, when the evidence points to the speed
difference being anywhere from minimal to completely unnoticeable (I recently
read a paper which suggested that Chrome's JIT optimizations have a _negative_
effect on overall performance due to their expense). Furthermore, Firefox uses
substantially less memory in general.

Extremely effective marketing on Google's part.

~~~
GeneralMaximus
You're right, but most people will not notice Chrome's sluggishness because
Google has worked very hard to ensure Chrome _feels_ fast. That, and (in my
experience) the fact that most Chrome users rarely go beyond 15-20 open tabs,
make Chrome an overall better experience than Firefox for many people. In UX
design, perception of speed counts almost as much as actual speed.

~~~
zobzu
The key for that is that the UI is in a separate process. Firefox for android
(Nightly and Aurora) also do that.

Of course Chrome also has a process per tab (and in fact a few more than
that), but the main thing is really a separate UI process (or lockless thread
for that matter).

Interestingly this is also what made BeOS so snappy. All BeOS apps _require_
an UI thread that is separated from the rest.

All that to say, while Firefox probably won't get a process per tab, I'd like
if they ported the Android UI process to the Desktop.

~~~
khuey
Actually in Firefox for Android the UI is just on a different thread than the
web content, not in a different process.

------
wazoox
All of my machines have only 2GB of RAM. On the Linux boxen, I have absolutely
no trouble running firefox with 50 tabs, OpenOffice and Gimp at the same time.
I don't monitor FF memory usage, because there isn't any significant problem.

On the other hand on the MacBook I must restart FF regularly, else over 700MB
of memory the application gradually slows down and "beachballs" regularly. I
don't know what's wrong exactly, because I have all the same extensions.

~~~
cheald
> All of my machines have only 2GB of RAM.

Out of curiosity, why? You can get 16GB of DDR3 for under $100 these days. The
upgrade from 4GB > 16GB and an SSD were _huge_ productivity boosters for me.
When you stop worrying about memory management (from a consumer perspective),
things are so much snappier.

~~~
kaolinite
If he doesn't need it, why spend the extra money? :-) It may be cheap but if
it's just going to sit there being unused then why bother at all?

~~~
wazoox
Actually I built these machines with parts I had lying around. As I only had 1
GB RAM sticks (and 2 RAM slots), well 2 GB I have. But as I said, I have quite
fat systems and for what I need (text editor, xterms, firefox, a little
LibreOffice and GIMP from time to time) it doesn't make any meaningful
difference.

A few months back I had a 2004 vintage machine with 1GB of RAM and the main
annoyance was that firefox was quite long to start up in the morning, and
that's about it. Ah, and spamassassin was a tad slow, too, meaning that my
emails needed a few minutes more to fetch in the background, no big deal. I
switched because the graphic card failed and I hadn't any AGP card anymore :)

------
bmurphy
Just because you have 16gb of memory doesn't mean you won't ever swap. Firefox
is not the only application running on a computer. My working set is routinely
over 7gb and I have 8gb on my laptop. A goldfish will grow to full its bowl.
If I had 16gb, I know I could use it. Every little bit counts.

~~~
StavrosK
Really? How? I'm currently coding and browsing the web and I'm only at 1 GB,
out of 2. Sure, the VM isn't on, but that's still another 500 MB.

~~~
darklajid
I don't understand what surprises you. The memory load depends in large parts
on the work requirements, I'd guess.

2 weeks ago I went from 4 GB to 8 GB (still would love to have more) here at
work, because 4 didn't cut it and lead to lots of paging.

    
    
      Visual Studio (often 2 or 3 instances, grabbing around 300-500 each)
      MS SQL Server
      IIS
      OCR Engines (depending on load)
    

With Windows 7 as host (already not a slim OS) this killed my productivity
with 4 GB, especially if (to get back on topic) I opened my beloved Firefox...

~~~
justincormack
Same here but from 8 to 16 on both my desktops. Huge improvement under
Windows, less under Linux with SSD. Working habits vary, but I multitask a
lot.

------
yuvadam
Mozilla has been making outstanding progress in decreasing Firefox's
footprint. At least from what I can see on the beta channel, things are
getting much better, every single day.

Props.

------
driverdan
I applaud the MemShrink team for their effort in finally fixing FF. Forgive my
ignorance but why are these leaks possible in the first place? Shouldn't the
browser manage and constrain plugins (sandbox?) to prevent issues like mem
leaks from even being possible? I understand the high level description of the
patch but I don't understand why this wouldn't have already been part of FF's
plugin management system. It seems like a pretty basic and core concept.

~~~
kibwen
Remember that Firefox was originally intended as a minimalist platform, with
the expectation that users would use its extension mechanism to build it up
according to their needs. As a result, Firefox's extension mechanism is quite
liberal. The upside is that its extensions are capable of much more than, for
example, addons in Chrome. The downside is that extensions are responsible for
much more, and can touch basically any part of the program (which is why
powerful addons are so prone to breaking with new versions of Firefox: they're
effectively targeting an unstable API).

Chrome addons are less prone to breakage and mischief, because Chrome addons
target a stable API with a limited set of functionality. Firefox introduced
just such an API last year, called the Jetpack API (it may have been renamed
since then). You can tell if an extension is using the Jetpack API if it
doesn't require a browser restart to install.

~~~
Erunno
"You can tell if an extension is using the Jetpack API if it doesn't require a
browser restart to install."

Not necessarily. "Traditional" extensions can be extended to support being
restartless as well if they implement the necessary hooks.

------
systematical
Better late than never, but you leaked more than just my system memory...you
leaked your own market share.

~~~
Erunno
Yeah, hopefully this will not go down in history as another too little, too
late effort. Firefox still has a sizable market share of about 20%-25%
(depending on the source) so Mozilla can still flex some muscle to keep the
web open. I dread the day when only cooperate players are left to decide about
the future of web technologies.

I wonder how the situation would look today if the MemShrink and Snappy
projects had been started in 2009 or 2010 at the latest. My gut feeling tells
me that the loss of market share and especially mindshare wouldn't have been
as dramatic as it is today. Oh well, I'm happy that Mozilla apparently got
their act together and taking the competition more seriously. Right now it's
fun looking forward to each next Firefox version. :-)

~~~
zobzu
Its hard to say. Bu where Chrome made the most impact is probably not the
geeky community, but mr everybody.

And how? => link on google.com telling you _have_ to get Chrome =>
bundling+force install+defaulting Chrome when updating acrobat reader, flash,
etc, even from Firefox or IE.

Both work fine as long as Chrome is a decent browser (and Chrome is a very
decent browser that's for sure)

They stopped the later and still do the former (it doesn't necessarily show up
in all situations so your mileage will certainly vary), any time you go on
Google.com with any browser. At least the former is not morally wrong, but it
certainly has a huge impact due to their near monopoly on search, and people
believing that Google _is_ the Internet and if Google says something, they
should probably do it.

I don't think Mozilla could beat neither of those 2 points, even thus they
could have lowered the overall impact by doing things better (especially their
switch to 6 weeks release without having silent update/auto addon compat, that
one was just plain dumb).

~~~
Erunno
Yeah, there are probably several factors which assisted Chrome's rise to
prominence. Obviously Google's huge marketing power and their bundling deals
can't be disregarded easily but in the end Chrome is also a great product.
It's fast (real and perceived performance), it has a remarkably polished
primary UI (though some of the secondary UIs like history are rather
suboptimal) and has neat features which only get slowly adopted by the
competitors (e.g. ingenious tab closing behavior, built-in translator, built-
in PDF reader, etc.). So great product + good marketing = success.

And the importance of geek/early adopter/enthusiast users shouldn't be
underestimated because these are the ones who often have wide reach (e.g.
journalists, bloggers, etc.) or are responsible for how web technologies are
used (e.g. developers). It's a bitter lesson the non-WebKit browsers vendors
had to learn after most mobile web developers started to target only WebKit
because that's the devices/browsers they are using on a day-to-day basis. And
in its early days Mozilla thrived on the free guerrilla marketing provided by
enthusiast users, not just in their immediate private space but also in
magazines, on websites and other outlets where users and authors were
constantly praising Firefox for its security, speed and features compared to
IE6. Today that place has been mostly taken over by Chrome.

I still having a hard time wrapping my head around how badly Mozilla handled
the appearance of Chrome for _years_. The threat was so obvious from the very
beginning and not just in hindsight. As I said, I have the impression that
they are on the right track now but there must be lessons to be learned from
the 2008 to 2011 period for Mozilla itself and other organizations in similar
situations. I wish Mozilla higher-ups would sit together and publish a
retrospective about what they perceive they did right and wrong.

------
acqq
According to the article, they plugged one leak but opened another, which
appears as soon as you have a simple Add-on made with, so typically, Mozilla's
own "Add-on SDK."

~~~
khuey
That's just a bug. It will be fixed (there's even a patch in
<https://bugzilla.mozilla.org/show_bug.cgi?id=752877>)

------
marklindhout
Pfew... 230 megabytes for a running browser. Not long ago that was all my
workstation had!

------
ck2
So every extension built with the SDK version before 1.6.1 is suspect.

That's a whole bunch of extensions.

~~~
khuey
That appears to be a bug in the approach we're using, and we think we have a
fix for it.

~~~
mistermann
This is great news. Any estimate on when these fixes might be released into a
production version?

~~~
khuey
We're on track to ship this in late August.

------
goggles99
Almost an identical title to this one 10 months ago... SMH

Mozilla May Have Plugged Firefox's Memory Leak Once and For All Posted
07/06/2011 at 8:36am | by Paul Lilly
[http://www.maximumpc.com/article/news/mozilla_may_have_plugg...](http://www.maximumpc.com/article/news/mozilla_may_have_plugged_firefoxs_memory_leak_once_and_all)

