If you’re a heavy tabs user, like most everyone in our office, you’ve probably seen Firefox go down in flames with Javascript errors.
Turns out, much of the problem was caused by too little available memory. Before 1.5.0.2, even those with a gigabyte of RAM ran into a hard-coded limit of 4MB for Last-Ditch Garbage Collection.
Firefox developers think the memory limitation may be the source for many of the crashes most frequently reported by the public.
Fixer-in-Chief Brendan Eich describes the scope of the trouble:
The problem with the 4MB threshold is actually two nasty bugs:
- You can hit it hard due to lots of JS objects, and you’re toast — no way around it. Even if you have 1GB of RAM and can well afford hundreds of megs on JS objects.
- You can hit it transiently, forcing a GC that does collect enough garbage to back off from the threshold by a decent interval. But hitting the threshold exposes more users to those bugs we’d rather find and fix by our own custom build stress-testing.
They fixed the bug by turning over responsibilty for locking-in the size of Javascript Garbage Collection (GC) to you. Otherwise, it will float as needed, just like… gulp… Microsoft’s much maligned Internet Explorer.
Developers were careful to maintain compatibility with earlier API versions, so Firefox can schedule its own GCs, and still run last-ditch GC whenever a specific byte limit is reached. This keeps those developers who embed Eich’s JavaScript in C engine, SpiderMonkey, happy and quiet.
The new floating GC system is also expected to be a boon for anyone developing large JavaScript-laden apps. You should appreciate it, too, if you habitually lots of Javascript-heavy web pages.
Is this the end of Firefox’s Javascript-crashing headaches? Developers sure hope so. At the least, they expect crashes to diminish.
Eich’s biggest complaint was the timing: “We should have done this for 1.5. The failure to raise or eliminate the threshold based on nominal heap size means greater memory pressure, sometimes putting the app on the edge of the cliff, where every allocation GCs. The app’s performance is miserable at that point, often bad enough that you have to kill it.”
Meanwhile, a key Microsoft advocate, Peter de Haas, is enjoying a smile at Mozilla’s expense, pointing to an article describing the major security and stability repairs in the update, and reminding us all that he’s “Just trying to keep score …;-)“
Hey. In this match, everybody wins.
Email Battles Backgrounder:

4 comments
Comments feed for this article
April 16th, 2006 at 2:57 am
Benjamin Smith
OMG! After spending BILLIONS of dollars, it’s conceded that Microsoft may have, in fact, come up with a GOOD IDEA.
Whoddathunkit?
Seriously, this rah-rah cheerleading gets old.
April 16th, 2006 at 11:21 am
BJ Gillette
“Seriously, this rah-rah cheerleading gets old.”
It’s amazing that just a couple of days ago, we were being blasted by IE fanboys for our article: “Survey of Internet Explorer 7 Beta 2 Reviews: Ouch! Ouch! Ouch!” (http://www.emailbattles.com/ archive/ battles/ browsers_aaddgijjba_de/)
Reread the article and follow the links. The Mozilla team that fixed this bug identified it as the #2 topcrash in Firefox.
So MS gets an oh-so-rare chance for a chuckle. So what? The fact that that’s *news* ought to say something to you.
April 18th, 2006 at 7:25 am
Vamsee
Hey, what abt tabbed browsing in IE 7 ?
April 18th, 2006 at 9:37 am
BJ Gillette
RE: “what abt tabbed browsing in IE 7 ?”
Vamsee… Really. Please see the comment immediately preceding yours.
We’ve covered IE’s foibles ad infinitum.
Read “Survey of Internet Explorer 7 Beta 2 Reviews: Ouch! Ouch! Ouch!” (http://www.emailbattles.com/archive/battles/browsers_aaddgijjba_de/), then follow the links in the Backgrounder at the end of the story.
New Article Idea: “Has The Internet Murdered Irony?”