Confirmed users
2,317
edits
No edit summary |
|||
| Line 1: | Line 1: | ||
= Firefox 3 Leak Testing How-To = | = Firefox 3 Leak Testing How-To = | ||
Note: this is a draft ! | |||
= Introduction= | = Introduction= | ||
| Line 5: | Line 7: | ||
Mozilla QA uses Trace Malloc Debug Build to test Firefox Components and Extensions for leaks. One part of this testing is manual testing. You can find the QA Firefox 3 Leak Testing Testplan [http://wiki.mozilla.org/MozillaQualityAssurance:Home_Page:Firefox_3.0_TestPlan:Leaks here]. | Mozilla QA uses Trace Malloc Debug Build to test Firefox Components and Extensions for leaks. One part of this testing is manual testing. You can find the QA Firefox 3 Leak Testing Testplan [http://wiki.mozilla.org/MozillaQualityAssurance:Home_Page:Firefox_3.0_TestPlan:Leaks here]. | ||
== Builds == | == Leak Gauge == | ||
For testing Firefox and Extensions for Memory we recommend "Leak Gauge" developed by [http://dbaron.org/ David Baron]. Leak Gauge 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. | |||
Leak Gauge is easy to use and '''you don't need''' to download any additional Software or Tool (like needed for Debug Builds). | |||
Leak Gauge will create a leak log file. You can upload this Log File [http://mxr.mozilla.org/mozilla/source/tools/footprint/leak-gauge.html here] to get a analysis if you have run into a memory leak. There are plans to move this upload later to a better location like AMO. | |||
=== Using Leak Gauge === | |||
As mentioned before, you don't need to install addional software to run Leak Gauge, however some simple tests are needed to run Leak Gauge and to get the Leak Log. | |||
1. Setting up the Environment Variable: | |||
The | The way to create the log is to set the environment variables: | ||
NSPR_LOG_MODULES=DOMLeak:5,DocumentLeak:5,nsDocShellLeak:5,NodeInfoManagerLeak:5 | |||
NSPR_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 | |||
As example for Windows, this should look like: | |||
* 1. Start the Windows Command Prompt (Start -> Run -> cmd.exe or Start -> Programs -> Accessories -> Command Prompt | |||
* 2. Set the env Variable: | |||
C:\>set NSPR_LOG_MODULES=DOMLeak:5,DocumentLeak:5,nsDocShellLeak:5,NodeInfoManagerLeak:5 | |||
and now you need to define the Location of the Leak Log File: | |||
C:\>set NSPR_LOG_FILE=c:\leak1.log | |||
(or any other location/file name of your choice) | |||
* 3. Start Firefox and your leak log will be created. | |||
Note: | |||
* When you test Firefox or your Extensions for leaks, you need to type the command above every time you start the Console/Terminal | |||
* Once you have this log from a complete run of the browser, you have | |||
to exit; otherwise it will look like everything leaked | |||
* Every time you start Firefox after you have defined the environment variables, your existing leak log will be overwritten. So if you want to reproduce a leak, or when you want to save a leak log, you need to change the filename (like from leak1.log to leak2.log) next time before you run Firefox. | |||
See also the steps for testing for more Information. | |||
=== The Leak Gauge Leak Log File=== | |||
You have setup the environment variables and you got a leak.log, Fine ! Now you need to upload this leak log on this [http://mxr.mozilla.org/mozilla/source/tools/footprint/leak-gauge.html site]. | |||
After you have uploaded a leak log, the site will display the output of the results from the leak log, which will tell you which of certain core objects leaked and the URLs associated with those objects. | |||
A normal output, without any leaking object / memory leak should look like: | |||
Results of processing log leak.log : | |||
Summary: | |||
Leaked 0 out of 11 DOM Windows | |||
Leaked 0 out of 44 documents | |||
Leaked 0 out of 3 docshells | |||
Leaked content nodes in 0 out of 0 documents | |||
== Debug Builds == | |||
You can also use debug builds for leak testing. Building and Running a Debug Build is more complex then using Leak Gauge. If you interested in running Leak Test Debug Builds you can find [http://wiki.mozilla.org/MozillaQualityAssurance:Home_Page:Firefox_3.0_TestPlan:Leaks:LeakTesting-How-To:Debug_Builds here] more information. | |||
= Leak Testing - Example of testing steps for Extension Testing = | = Leak Testing - Example of testing steps for Extension Testing = | ||