Firefox 7 comes with awesome memory fixes but there are also major Garbage Collection (GC) improvements in Firefox 6. Firefox has a stop-the-world mark-and-sweep garbage collector with conservative stack scanning. In prior work we reduced the workload of an average GC to the compartment (or tab) that allocates most memory and therefore is a good target to reclaim most memory.
Depending on the workload we can get GC pauses up to 200 msec or even more on low-end laptops. If most objects are reachable we have high marking cost and if most objects are unreachable we spend most time in sweeping. We talked about an improvement of the sweeping phase for a long time and a few months ago I landed a patch where most finalization is moved from the main thread to a background thread. We can’t do all finalization on the background thread because the browser uses external finalizes that rely on the finalization during the GC event. Our measurements show that we usually finalize more than 95% of all objects on the background thread.
Bill McCloskey is also working on a generational and incremental GC model that will show further improvements.