Memory leak detection in WebKitGTK+

Mario already shared last week the effort he has been lately putting on accessibility in WebKit. Besides that, and among other things, here at Samsung we have been also paying attention to memory usage.

Two months ago, my colleague Brian introduced a memory leak detection tool for the GTK port in WebKit –although it could be easily extended to other ports where valgrind is available. This tool hooks into run-webkit-tests, and when the --leaks flag is used together with --wrapper, it launches DumpRenderTree under valgrind, gets the leaks found and parses them to generate a report.

There are some differences between how valgrind works and how the leak-tool in Mac works, so while most of the design of run-webkit-tests can be reused (hooking, for example, into --check_for_leaks and --print_leaks_summary), there are some additional pieces that need to be done, such as passing --wrapper as well. Anyway, not having to pass --wrapper is in the roadmap as a future improvement.

You can take a look at the patch here and contribute to the discussion with additional design ideas. Or simply apply it locally and use it to detect leaks: Brian has already done that with a set of the LayoutTests, finding and fixing a number of leaks.

social