Bug 86872 - [GTK] [WK2] Memory leaks in WebKitBackForwardList
Summary: [GTK] [WK2] Memory leaks in WebKitBackForwardList
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sudarsana Nagineni (babu)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-18 10:52 PDT by Sudarsana Nagineni (babu)
Modified: 2012-05-18 14:35 PDT (History)
5 users (show)

See Also:


Attachments
Fix memory leaks (3.44 KB, patch)
2012-05-18 11:14 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-18 10:52:21 PDT
Valgrind reports the following memory leaks in WebKitBackForwardList. Fix these leaks by adopting an allocation of BackForwardList using AdoptWK.

==26452== 40 bytes in 1 blocks are definitely lost in loss record 3,746 of 7,883
==26452==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26452==    by 0xC0F579E: WTF::fastMalloc(unsigned long) (FastMalloc.cpp:268)
==26452==    by 0x605A4A6: WTF::ThreadSafeRefCountedBase::operator new(unsigned long) (ThreadSafeRefCounted.h:72)
==26452==    by 0x608CA57: WebKit::ImmutableArray::create() (ImmutableArray.h:44)
==26452==    by 0x6133EF5: WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit(unsigned int) (WebBackForwardList.cpp:199)
==26452==    by 0x60C3BFC: WKBackForwardListCopyForwardListWithLimit (WKBackForwardList.cpp:76)
==26452==    by 0x60CEDE2: webkit_back_forward_list_get_forward_list_with_limit (WebKitBackForwardList.cpp:302)
==26452==    by 0x4093A7: browserWindowUpdateNavigationActions (BrowserWindow.c:205)
==26452==    by 0x409425: backForwadlistChanged (BrowserWindow.c:213)
==26452==    by 0x62ACE52: webkit_marshal_VOID__OBJECT_POINTER (WebKitMarshal.cpp:436)
==26452==    by 0xAF35CA1: g_closure_invoke (gclosure.c:777)
==26452==    by 0xAF46D70: signal_emit_unlocked_R (gsignal.c:3547)
==26452==    by 0xAF4F098: g_signal_emit_valist (gsignal.c:3296)
==26452==    by 0xAF4F241: g_signal_emit (gsignal.c:3352)
==26452==    by 0x60CE6D4: webkitBackForwardListChanged(_WebKitBackForwardList*, OpaqueWKBackForwardListItem const*, OpaqueWKArray const*) (WebKitBackForwardList.cpp:161)
==26452==    by 0x60D995B: didChangeBackForwardList(OpaqueWKPage const*, OpaqueWKBackForwardListItem const*, OpaqueWKArray const*, void const*) (WebKitLoaderClient.cpp:114)
==26452==    by 0x615F264: WebKit::WebLoaderClient::didChangeBackForwardList(WebKit::WebPageProxy*, WebKit::WebBackForwardListItem*, WTF::Vector<WTF::RefPtr<WebKit::APIObject>, 0ul>*) (WebLoaderClient.cpp:
==26452==    by 0x6166EE1: WebKit::WebPageProxy::didChangeBackForwardList(WebKit::WebBackForwardListItem*, WTF::Vector<WTF::RefPtr<WebKit::APIObject>, 0ul>*) (WebPageProxy.cpp:641)
==26452==    by 0x61337B3: WebKit::WebBackForwardList::goToItem(WebKit::WebBackForwardListItem*) (WebBackForwardList.cpp:115)
==26452==    by 0x616F7EB: WebKit::WebPageProxy::backForwardGoToItem(unsigned long, WebKit::SandboxExtension::Handle&) (WebPageProxy.cpp:2653)
==26452==    by 0x629EE1D: void CoreIPC::callMemberFunction<WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long, WebKit::SandboxExtension::Handle&), unsigned long, WebKit::SandboxExtension::
==26452==    by 0x629B9DC: void CoreIPC::handleMessage<Messages::WebPageProxy::BackForwardGoToItem, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long, WebKit::SandboxExtension::Handle&)>(C
==26452==    by 0x6297B1A: WebKit::WebPageProxy::didReceiveSyncWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&) (WebPageProxy
==26452==    by 0x616ABEF: WebKit::WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&) (WebPageProxy.cpp:1759)
==26452==    by 0x619F168: WebKit::WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&) (WebProcessProxy.cpp:3
==26452==    by 0x6134ED0: WebKit::WebConnectionToWebProcess::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&) (WebConnecti
==26452==    by 0x6059E48: CoreIPC::Connection::dispatchSyncMessage(CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) (Connection.cpp:647)
==26452==    by 0x605A0C8: CoreIPC::Connection::dispatchMessage(CoreIPC::Connection::Message<CoreIPC::ArgumentDecoder>&) (Connection.cpp:690)
==26452==    by 0x6057E05: CoreIPC::Connection::SyncMessageState::dispatchMessages() (Connection.cpp:169)
==26452==    by 0x6057EC8: CoreIPC::Connection::SyncMessageState::dispatchMessageAndResetDidScheduleDispatchMessagesWork() (Connection.cpp:181)
==26452==    by 0x606453B: WTF::FunctionWrapper<void (CoreIPC::Connection::SyncMessageState::*)()>::operator()(CoreIPC::Connection::SyncMessageState*) (Functional.h:173)
==26452==    by 0x60643C3: WTF::BoundFunctionImpl<WTF::FunctionWrapper<void (CoreIPC::Connection::SyncMessageState::*)()>, void ()(CoreIPC::Connection::SyncMessageState*)>::operator()() (Functional.h:405)
==26452==    by 0x606928D: WTF::Function<void ()()>::operator()() const (Functional.h:613)
==26452==    by 0x6B45054: WebCore::RunLoop::performWork() (RunLoop.cpp:67)
==26452==    by 0x754B439: WebCore::RunLoop::queueWork(WebCore::RunLoop*) (RunLoopGtk.cpp:102)
==26452==    by 0xB1BCC99: g_main_context_dispatch (gmain.c:2515)
==26452==    by 0xB1BD05F: g_main_context_iterate.isra.23 (gmain.c:3123)
==26452==    by 0xB1BD459: g_main_loop_run (gmain.c:3317)
==26452==    by 0xA6C925C: gtk_main (gtkmain.c:1165)
==26452==    by 0x40B12E: main (main.c:233)

==26452== 40 bytes in 1 blocks are definitely lost in loss record 3,747 of 7,883
==26452==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26452==    by 0xC0F579E: WTF::fastMalloc(unsigned long) (FastMalloc.cpp:268)
==26452==    by 0x605A4A6: WTF::ThreadSafeRefCountedBase::operator new(unsigned long) (ThreadSafeRefCounted.h:72)
==26452==    by 0x608CA57: WebKit::ImmutableArray::create() (ImmutableArray.h:44)
==26452==    by 0x6133D51: WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit(unsigned int) (WebBackForwardList.cpp:181)
==26452==    by 0x60C3B9E: WKBackForwardListCopyBackListWithLimit (WKBackForwardList.cpp:71)
==26452==    by 0x60CEC4B: webkit_back_forward_list_get_back_list_with_limit (WebKitBackForwardList.cpp:272)
==26452==    by 0x40934A: browserWindowUpdateNavigationActions (BrowserWindow.c:200)
==26452==    by 0x409425: backForwadlistChanged (BrowserWindow.c:213)
==26452==    by 0x62ACE52: webkit_marshal_VOID__OBJECT_POINTER (WebKitMarshal.cpp:436)
==26452==    by 0xAF35CA1: g_closure_invoke (gclosure.c:777)
==26452==    by 0xAF46D70: signal_emit_unlocked_R (gsignal.c:3547)
==26452==    by 0xAF4F098: g_signal_emit_valist (gsignal.c:3296)
==26452==    by 0xAF4F241: g_signal_emit (gsignal.c:3352)
==26452==    by 0x60CE6D4: webkitBackForwardListChanged(_WebKitBackForwardList*, OpaqueWKBackForwardListItem const*, OpaqueWKArray const*) (WebKitBackForwardList.cpp:161)
==26452==    by 0x60D995B: didChangeBackForwardList(OpaqueWKPage const*, OpaqueWKBackForwardListItem const*, OpaqueWKArray const*, void const*) (WebKitLoaderClient.cpp:114)
==26452==    by 0x615F264: WebKit::WebLoaderClient::didChangeBackForwardList(WebKit::WebPageProxy*, WebKit::WebBackForwardListItem*, WTF::Vector<WTF::RefPtr<WebKit::APIObject>, 0ul>*) (WebLoaderClient.cpp:
==26452==    by 0x6166EE1: WebKit::WebPageProxy::didChangeBackForwardList(WebKit::WebBackForwardListItem*, WTF::Vector<WTF::RefPtr<WebKit::APIObject>, 0ul>*) (WebPageProxy.cpp:641)
==26452==    by 0x61335CE: WebKit::WebBackForwardList::addItem(WebKit::WebBackForwardListItem*) (WebBackForwardList.cpp:95)
==26452==    by 0x616F6DF: WebKit::WebPageProxy::backForwardAddItem(unsigned long) (WebPageProxy.cpp:2641)
==26452==    by 0x629C8E0: void CoreIPC::callMemberFunction<WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long), unsigned long>(CoreIPC::Arguments1<unsigned long> const&, WebKit::WebPagePro
==26452==    by 0x629A264: void CoreIPC::handleMessage<Messages::WebPageProxy::BackForwardAddItem, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long)>(CoreIPC::ArgumentDecoder*, WebKit::We
==26452==    by 0x6296E8B: WebKit::WebPageProxy::didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) (WebPageProxyMessageReceiver.cpp:346)
==26452==    by 0x616AB32: WebKit::WebPageProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) (WebPageProxy.cpp:1738)
==26452==    by 0x619F041: WebKit::WebProcessProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) (WebProcessProxy.cpp:333)
==26452==    by 0x6134E7A: WebKit::WebConnectionToWebProcess::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) (WebConnectionToWebProcess.cpp:92)
==26452==    by 0x605A10A: CoreIPC::Connection::dispatchMessage(CoreIPC::Connection::Message<CoreIPC::ArgumentDecoder>&) (Connection.cpp:692)
==26452==    by 0x605A2A8: CoreIPC::Connection::dispatchOneMessage() (Connection.cpp:718)
==26452==    by 0x6064445: WTF::FunctionWrapper<void (CoreIPC::Connection::*)()>::operator()(CoreIPC::Connection*) (Functional.h:173)
==26452==    by 0x606424B: WTF::BoundFunctionImpl<WTF::FunctionWrapper<void (CoreIPC::Connection::*)()>, void ()(CoreIPC::Connection*)>::operator()() (Functional.h:405)
==26452==    by 0x606928D: WTF::Function<void ()()>::operator()() const (Functional.h:613)
==26452==    by 0x6B45054: WebCore::RunLoop::performWork() (RunLoop.cpp:67)
==26452==    by 0x754B439: WebCore::RunLoop::queueWork(WebCore::RunLoop*) (RunLoopGtk.cpp:102)
==26452==    by 0xB1BCC99: g_main_context_dispatch (gmain.c:2515)
==26452==    by 0xB1BD05F: g_main_context_iterate.isra.23 (gmain.c:3123)
==26452==    by 0xB1BD459: g_main_loop_run (gmain.c:3317)
==26452==    by 0xA6C925C: gtk_main (gtkmain.c:1165)
==26452==    by 0x40B12E: main (main.c:233)
Comment 1 Sudarsana Nagineni (babu) 2012-05-18 11:14:39 PDT
Created attachment 142742 [details]
Fix memory leaks

Fix memory leaks in WebKitBackForwardList.
Comment 2 WebKit Review Bot 2012-05-18 11:19:21 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Martin Robinson 2012-05-18 11:41:52 PDT
Comment on attachment 142742 [details]
Fix memory leaks

Thank you very much!
Comment 4 Sudarsana Nagineni (babu) 2012-05-18 12:06:25 PDT
Thanks for your review.
Comment 5 WebKit Review Bot 2012-05-18 14:35:50 PDT
Comment on attachment 142742 [details]
Fix memory leaks

Clearing flags on attachment: 142742

Committed r117630: <http://trac.webkit.org/changeset/117630>
Comment 6 WebKit Review Bot 2012-05-18 14:35:54 PDT
All reviewed patches have been landed.  Closing bug.