$Id: leak-gauge.html,v 1.6 2006-01-14 00:27:41 dbaron%dbaron.org Exp $
This script is designed to help testers isolate and simplify testcases for many classes of leaks (those that involve large graphs of core data structures) in Mozilla-based browsers. It is designed to print information about what has leaked by processing a log taken while running the browser. Such a log can be taken over a long session of normal browsing and then the log can be processed to find sites that leak. Once a site is known to leak, the logging can then be repeated to figure out under what conditions the leak occurs.
The way to create this log is to set the environment variables:
NSPR_LOG_MODULES=DOMLeak:5,DocumentLeak:5,nsDocShellLeak:5 NSPR_LOG_FILE=nspr.log (or any other filename of your choice)
in your shell and then run the program.
set VAR=value
export VAR=value
setenv VAR value
This script will not work from a Web page. It will work only in relatively recent Mozilla-based browsers and only when loaded as a file from your disk. You will be asked to give it permission to execute arbitrary code. You should only grant this permission if you trust this page.
Once you have this log from a complete run of the browser (you have to exit; otherwise it will look like everything leaked), you can load this page from your disk (be careful not to overwrite the log when starting the browser to load this page) and enter the filename of the log. Then you'll see the output below, which will tell you which of certain core objects leaked and the URLs associated with those objects.