I've been working on memory leaks in Mozilla for a while. Back in
2000, when I first got interested in fixing memory leaks (at least
partly thanks to reading some bugs filed by Bruce Mitchener), one of the
things I focused on was trying to fix the leak number that showed up on
tinderbox. The first bug
in that quest was a pretty interesting one, and a number of the other
early bugs were real leaks that affected users (including a whole bunch
related to form controls). The leak numbers on tinderbox got pretty
low, and most of the number shown was due to shutdown leaks: leaks where
we allocated an object that was supposed to exist for the lifetime of
the application, but then we didn't free it at shutdown. Not a real
problem, and only harmful in that it cluttered up the list of objects
that weren't freed at shutdown and made it slightly harder to find real
leaks.
So I eventually moved on to working on reducing measures of memory
leaks that were more
relevant to problems that users experience (the amount of memory
Firefox uses being large and increasing over time). I eventually added
a better leak test to tinderbox and renamed the old one (which only
measured leaks of XPCOM objects and certain other logged objects) to
RLk
. (That improved the measurement of leaks during the
test, but we still really need a leak test that exercises more
code.)
But recently, sayrer
revived an old patch
to make XPConnect shut down more cleanly and stop giving false leak
reports anytime somebody did anything interesting in a JS component, and
bsmedberg fixed some leaks
very near main
, and the RLk
number dropped
precipitously close to zero. I debugged the last
issue last week (amazingly enough, it was not a shutdown
leak, although the only XPCOM object leaked was a singleton). I checked
that patch in just now, so now, for the first time, we have a tinderbox
showing RLk: 0B
for reasons other than the leak test
being broken. It's not very important compared to the other memory leak
work going on, but it is rather satisfying.