The Valgrind Test Job

The Valgrind test job builds the browser and runs it under Valgrind, which can detect various common memory-related errors. This job only runs on Linux64, which is the platform best suited to running Valgrind.

Running the Valgrind test job locally

Valgrind works best on Linux. It also works on Mac, though sometimes not as well.

Building

You need a Valgrind-enabled build of Firefox. Add the following lines to your mozconfig file.

ac_add_options --enable-valgrind
ac_add_options --disable-jemalloc

Running

To run the Valgrind test job locally, run the following command.

mach valgrind-test

See also the general instructions for using Valgrind with Mozilla code.

Understanding errors

For each problem that Valgrind finds, it emits a message describing the problem, along with a stack trace indicating where the problem occurs. It also prints a suppression, which is a sequence of text that can be put in a suppression file (and specified via Valgrind's --suppressions option) if you want Valgrind to ignore such errors in future runs. For example, we have a small number of deliberate but inconsequential memory leaks in the codebase that have corresponding suppressions. But generally errors should be fixed rather than suppressed.

When running locally, you may see errors that do not occur on the test machines. Errors in system libraries can generally be ignored, because they are out of our control and the kind of thing we suppress on the test machines. Errors in Mozilla code should probably be reported in bugs!

If you need help or experience problems

If you need help with the Valgrind test job, please contact Nicholas Nethercote or Gary Kwong. Julian Seward can also help with Valgrind issues.

Alternatively, bugs relating to the test job can be filed in the "Testing" product, under the "General" component. Please CC :njn and :gkw on any such bugs.