mozilla/addon-sdk — pull request #598 by Mossop (2012-10-04 20:29:24+00:00)
Title: Bug 792636 - Add some automated leak detection

I'd like to get some feedback on this @ochameau. It adds some very basic leak detection that displays if it thinks something has leaked at the end of the test run. It works using memory reporters. Before running tests it makes a list of all the JS compartments and windows that are in memory. After the test run it checks to see if anything new is there (ignoring a blacklist of chrome stuff). If there is it logs it.

Currently though it is not very reliable. Sometimes it will find a bunch of leaks, sometimes it won't. I ran it for every test individually and in the cases where it was reliably claiming a leak I always found a real cause for it. It now only reliably claims a leak for the private browsing module, and I think that is a real leak in platform code.

To try to make it more reliable I tried having it delay and re-check for up to a second, running GC each time, but still no joy. Do you have any ideas what might be going on?

The next step of this would probably be to also run the leak check after each test file, or even each individual test in the file to make it easier to narrow down the problems but that is pointless unless it gets more reliable.