Performance:Cycle Collector Dumps

From MozillaWiki
Jump to: navigation, search

A memory leak is when the amount of memory used increases over time, or when memory is not freed when it is expected to be. Memory leaks can occur in Web pages or applications. If the memory is not released (at least to the browser, not necessarily to the OS) after closing the Web page, the leak is definitely a bug in the browser. If the memory is released when closing the Web page, it might be a bug in the browser or a bug in the Web page. In all of these cases, we'd like to be able to figure out the cause of the leak (whether it's in the browser or the Web page) so that it can be fixed.

Firefox release builds (starting with Firefox 4.0b7; see bug 466157) have the capability to dump the cycle collector graph to a file. This lets users provide data to help debug DOM-related or JS-related memory leaks that have unknown causes or require a long time to trigger.

Generating a cycle collector dump

A more up-to-date overview of how to generate a cycle collector dump is located here.

Note that entering code in the error console allows code to run with full (chrome) privileges, so you should treat copying code to the error console much like copying code to a command prompt; you should trust the source or read the code to make sure it does what you expect.

Doing this will create a file called cc-edges-N.log (where N is a number) in the working directory of the firefox process (i.e., the directory in which it was started), which is likely to be the home directory on Mac and Linux (???) and ??? on Windows.