Thursday, February 22, 2007

There are a lot of tests written in C++ and there are a lot of different ways that they log their results. Among the strings that one finds are ": PASS", "INFO PASS", "tests passed.", "... OK", and so on. And that is only for the successful runs of the tests.

This describes in very practical terms how to create reftests. It turns out to be way easier than it seemed at first. Really, I just had to map what reftest did into my head. Not being a long-time Mozilla-ish person, it probably took me longer than it would take others.

Here is a slice from the page, giving instructions on just the first test. Please see the page for more info. There are details in the full instructions that may be useful. And if something seems wrong, please feel free to update the page. Send me an e-mail if you would like, but wiki is more wiki if people really edit what they see. And now for the show.

Step 1: Build a copy of Firefox for yourself.

Step 2: Open a terminal window. Create a directory and make that your current directory.

Tuesday, February 06, 2007

If you are using a Mac OS X machine and have Apple's Developer Tools, such as Xcode, on it, you have access to a very quick and easy way to check for memory leaks. Not everyone knows about this, though it has been available for at least a few versions of the Dev Tools, so I thought I would put this out.

If an application is running and you want to see if it is leaking memory, you can do run leaks and give it either a pid as a parameter, or a string matchable to the running process, such as "firefox-bin" or "thunderbird-bin". The string matching only works if only one such process is running. Here is an example:

This one actually goes on for about 350,000 lines. I had been running this instance of Firefox 2.0.0.1 for about an hour, but with a lot of tab use.

You can get stack frames and symbols in the stacks of leaked objects if you set environment variables that are explained in the man page.

I think there is a lot of room for improvement in controlling memory leaks.

There is actually much more I could say about this, but that is for another discussion. Really, I just wanted to say, here is a tool. It gives information. It is pretty accurate. If anyone has questions about using it, check the man page for the leaks executable, or feel free to ask me.