Bug 87943 - [GTK] Memory leak in webkit_web_view_init
Summary: [GTK] Memory leak in webkit_web_view_init
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sudarsana Nagineni (babu)
Depends on:
Reported: 2012-05-31 02:16 PDT by Sudarsana Nagineni (babu)
Modified: 2012-05-31 10:29 PDT (History)
5 users (show)

See Also:

Patch (2.37 KB, patch)
2012-05-31 05:58 PDT, Sudarsana Nagineni (babu)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sudarsana Nagineni (babu) 2012-05-31 02:16:13 PDT
Valgrind reports the following memory leak in webkit_web_view_init.

==9443== 8 bytes in 1 blocks are definitely lost in loss record 1,319 of 31,982
==9443==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9443==    by 0x61FB418: webkit_web_view_init(_WebKitWebView*) (webkitwebview.cpp:3558)
==9443==    by 0xB19F956: g_type_create_instance (gtype.c:1892)
==9443==    by 0xB1840B8: g_object_constructor (gobject.c:1849)
==9443==    by 0xB1856E3: g_object_newv (gobject.c:1713)
==9443==    by 0xB1861EB: g_object_new (gobject.c:1542)
==9443==    by 0x61FB87D: webkit_web_view_new (webkitwebview.cpp:3612)
==9443==    by 0x4049B1: createWindow (main.c:306)
==9443==    by 0x4053A8: main (main.c:519)

Looks like UserMediaClientGtk is not deleted when UserMediaController is destroyed.
Comment 1 Sudarsana Nagineni (babu) 2012-05-31 03:44:42 PDT
This leak can be fixed by deleting UserMediaClientGtk in pageDestroyed() or making the client to be owned by the WebView so that it will be deleted when the view goes away. IMO, the second option is nice because it avoids the pageDestroyed notification function.
Comment 2 Sudarsana Nagineni (babu) 2012-05-31 05:58:13 PDT
Created attachment 145067 [details]

Fix for UserMediaClientGtk leak.
Comment 3 WebKit Review Bot 2012-05-31 10:29:21 PDT
Comment on attachment 145067 [details]

Clearing flags on attachment: 145067

Committed r119118: <http://trac.webkit.org/changeset/119118>
Comment 4 WebKit Review Bot 2012-05-31 10:29:25 PDT
All reviewed patches have been landed.  Closing bug.