MozillaQualityAssurance:Home Page:Firefox 3.0 TestPlan:Leaks:LeakTesting-How-To:Debug Builds
Testing Extensions and Firefox for Memory Leaks with a Debug Build
The Debug Builds for Leak Testing need to be build individually.
Debug Builds (for Leak Testing) are much bigger then normal optimized Firefox Builds. A Debug Leak Testing can be need up to 1,2 GB Disk Space.
You can download debug builds from the Mozilla FTP Server. Select the wanted branch and operating system from the tinderbox-builds directory and also open the folder in it. Download and unzip the *crashreport-symbols.zip build.
Running a Leak Testing Build
Open a Terminal window (or xterm or Gnome Terminal) and enter:
Note that the directory you drop your leak.log into should already exist, so if it's not there, please create it first.
Run the debug build of firefox creating a new profile. For mac, this would be:
cd /location of your debug build/firefox-debug/dist/ FirefoxDebug.app/Contents/MacOS
linux (and when you use Mozilla Build on Windows) is:
cd /location of your debug build/firefox-debug/dist/bin
At the end of the run, the contents of ~/tmp/leak.log should have something in it.
How do i know when i have found a leak ?
When you run Firefox like described above and quit Firefox later you get a Statistic in the Console where you have started Firefox.
If no leak was found the output looks like the following:
nsStringStats => mAllocCount: 79737 => mReallocCount: 4990 => mFreeCount: 79737 => mShareCount: 58374 => mAdoptCount: 4593 => mAdoptFreeCount: 4593
and the leak.log stays empty.
When you run into a Memory leak the Stats look as example like this:
nsStringStats => mAllocCount: 32807 => mReallocCount: 3994 => mFreeCount: 32805 -- LEAKED 2 !!! => mShareCount: 30349 => mAdoptCount: 3524 => mAdoptFreeCount: 3524
When you run into a leak you see also a lot of information in the leaks.log. This log is needed for debugging and fixing the leak.