[webkit-dev] [WIP][GTK] Memory leak detection

Brian Holt brian.holt at samsung.com
Mon May 20 07:48:51 PDT 2013


Memory leak detection is a recurrent topic on this mailing list [1-5] but at present there exists only support for the Mac leaks tool[6].  The de facto standard for memory checking and leak detection for Unix is Valgrind and the goal of this work is to launch the DRT under Valgrind to generate a xml file with details of leaks found, and then to parse this file and display this information.



Failures should result in the filing of memory bugs and adding the error to the suppression file.  Chromium has a fairly mature process[7] for this which can been taken as the starting point.



This work is being tracked under https://bugs.webkit.org/show_bug.cgi?id=116317.



This is a work in progress, but as a first attempt leak checking can be done using the existing run-webkit-tests script as follows:



$ Tools/Scripts/run-webkit-tests --gtk --leak --wrapper="valgrind" LayoutTests/accessibility/accessibility-node-memory-management.html



The wrapper argument is used as a workaround because the the existing hooks "check_for_leaks" and "print_leaks_summary" happen *after* the test has finished running, while we need to launch the test already under Valgrind. Valgrind options are passed by setting VALGRIND_OPTS, but could be changed to use a configuration file instead.



At present only minimal changes have been made to the Mac-specific leak code.  In a subsequent bug, perhaps the run-leaks perl script that checks for leaks on Mac can be refactored into a "wrapper" that chooses which platform-dependent script to run, so there could be a run-gtk-leaks, run-mac-leaks, with run-leaks picking the right one.

Comments and feedback welcome!

Regards
Brian

[1] https://lists.webkit.org/pipermail/webkit-dev/2009-April/007269.html
[2] https://lists.webkit.org/pipermail/webkit-gtk/2010-March/000162.html
[3] https://lists.webkit.org/pipermail/webkit-gtk/2011-February/000406.html
[4] https://lists.webkit.org/pipermail/webkit-gtk/2010-November/000346.html
[5] https://lists.webkit.org/pipermail/webkit-gtk/2010-September/000330.html
[6] http://cocoadev.com/wiki/TheLeaksTool
[7] http://dev.chromium.org/developers/tree-sheriffs/sheriff-details-chromium/memory-sheriff#TOC-Filing-good-memory-bugs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130520/394ae12f/attachment.html>


More information about the webkit-dev mailing list