I spent the day looking into
- Issue 2187: firebug causes memory leaks
I still don’t know if there is a memory leak (or even how to find it if there is), but I sure found a problem. When Firebug’s Error module is active and we load gmail.com, it takes about 90 sec on Firefox 3.7 nightly build. With the Error module inactive, it’s about 6 seconds. (On a Firefox debug build the load never completes). The memory goes up dramatically, so my guess it that this is the source of both the excessive CPU time and apparent leaks. Note that gmail.com does generate a huge number of errors.
For now the only workaround is to disable the Firebug Console (with the mini menu on the Console tab). Firebug 1.5a22 will have a slightly better workaround, it will disable the Error module if you turn off all error and warning settings in the Console.
To find the problem itself may be hard. Chromebug’s profiler did not work, so I’ll fix it and see if that gives some hints. There is not a lot of code in Firebug’s Error module, so I’m surprised that is the culprit.
Update: the problem was tracked down to the code that assigns error messages to the correct window. In looking through all the URLs for a page, you need to look for imported style sheets. That is done by looking through all of the rules in a style sheet for import rules. We processed 13,000+ rules, requiring ~1 sec to process all of them. This was done once for each of the 100 errors. So we get 90 sec load time. A bug was causing us to revisit the same style sheet 6 times (gmail uses 2318 rules); cutting off the rule search when imports can no long be possible and caching the results brings us back near zero, so the total load time is now around 6 sec.