# Leak Gauge

    $Id: leak-gauge.html,v 1.8 2008/02/08 19:55:34 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:

      MOZ_LOG=DOMLeak:5,DocumentLeak:5,nsDocShellLeak:5,NodeInfoManagerLeak:5
      MOZ_LOG_FILE=nspr.log     (or any other filename of your choice)

in your shell and then run the program.

- In a Windows command prompt, set environment variables with

          set VAR=value

- In an sh-based shell such as bash, set environment variables with

          export VAR=value

- In a csh-based shell such as tcsh, set environment variables with

          setenv VAR value

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 (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.