[webkit-dev] [GTK] Memory leak detection

Brian Holt brian.holt at samsung.com
Wed Jul 17 03:10:40 PDT 2013

This patch has proven itself as quite useful so far for finding and
resolving leaks.  https://bugs.webkit.org/show_bug.cgi?id=116317 will remain
open as the metabug tracking leaks and a new bug
https://bugs.webkit.org/show_bug.cgi?id=118785 has been created to oversee
the patch. 


Comments and feedback welcome.





From: webkit-dev-bounces at lists.webkit.org
[mailto:webkit-dev-bounces at lists.webkit.org] On Behalf Of Brian Holt
Sent: 20 May 2013 15:49
To: webkit-dev at lists.webkit.org
Subject: [webkit-dev] [WIP][GTK] Memory leak detection


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


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


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"


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!





[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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130717/aea13916/attachment.html>

More information about the webkit-dev mailing list