Cycle collector helps finding leaks in Firefox
To help find memory leaks in Mozilla Firefox the Mozilla developers has the last couple of weeks landed the so called XPCOM cycle collector. This tool thats built into Mozilla helps to avoid memory leaks that can make Firefox take up too much memory and make it slower. It periodically checks the Firefox memory usage and tries to free any unused memory. More and more areas of the Firefox code will support this feature and hopefully we'll have a Firefox 3 that will use less memory.
So how does it work. From the XPCOM cycle collector webpage:
The cycle collector spends most of its time accumulating (and forgetting about) pointers to XPCOM objects that might be involved in garbage cycles. Periodically the collector wakes up and examines any suspicious pointers that have been sitting in its buffer for a while. If the collector finds a group of objects that all refer back to one another, and establishes that the objects' reference counts are all accounted for by internal pointers within the group, it considers that group cyclical garbage, which it then attempts to free.
Read the meta bug about the collector.