NEW 116139
[WK2] LEAK: ThreadFunctionInvocation* seems to be leaked in createThreadInternal
https://bugs.webkit.org/show_bug.cgi?id=116139
Summary [WK2] LEAK: ThreadFunctionInvocation* seems to be leaked in createThreadInternal
KyungTae Kim
Reported 2013-05-14 23:16:05 PDT
The below memory leak issue was found with Valgrind: ==6322== 8 bytes in 1 blocks are definitely lost in loss record 144 of 1,256 ==6322== at 0x483486C: operator new(unsigned int) (vg_replace_malloc.c:292) ==6322== by 0x5BE888B: WTF::createThreadInternal(void (*)(void*), void*, char const*) (ThreadingPthreads.cpp:164) ==6322== by 0x5BD5DFF: WTF::createThread(void (*)(void*), void*, char const*) (Threading.cpp:86) ==6322== by 0x4C5E1D7: WorkQueue::platformInitialize(char const*) (WorkQueueEfl.cpp:62) ==6322== by 0x4CEAB8D: WebKit::WebProcessProxy::connect() (WorkQueue.cpp:32) ==6322== by 0x4D54951: WebKit::WebProcessProxy::WebProcessProxy(WTF::PassRefPtr<WebKit::WebContext>) (WebProcessProxy.cpp:85) ==6322== by 0x4D54999: WebKit::WebContext::ensureWebProcess() (WebProcessProxy.cpp:71) ==6322== by 0x4D58181: WebKit::WebContext::createWebPage(WebKit::PageClient*, WebKit::WebPageGroup*) (WebContext.cpp:502) ==6322== by 0x4C7CB4F: _ewk_view_initialize(_Evas_Object*, WTF::PassRefPtr<Ewk_Context>, OpaqueWKPageGroup const*) (ewk_view.cpp:1240) ==6322== by 0x4C7D1F3: ewk_view_smart_add (ewk_view.cpp:1418) ==6322== by 0x4C7D433: ewk_view_add_with_context (ewk_view.cpp:1429) ==6322== by 0x4C7D4C3: ewk_view_add (ewk_view.cpp:1434) The variable "invocation" is allocated in createThreadInterna, and passed to "pthread_create". I think the "pthread_create" doesn't manage the "void *arg" argument, so some routine is needed to free that pointer. ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*) { OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(new ThreadFunctionInvocation(entryPoint, data)); pthread_t threadHandle; if (pthread_create(&threadHandle, 0, wtfThreadEntryPoint, invocation.get())) return 0; ThreadFunctionInvocation* leakedInvocation = invocation.leakPtr();
Attachments
Alexey Proskuryakov
Comment 1 2013-05-15 12:02:58 PDT
> ==6322== by 0x5BE888B: WTF::createThreadInternal(void (*)(void*), void*, char const*) (ThreadingPthreads.cpp:164) Looks like this uses old or customized sources, ToT WebKit has this function at a different line. A comment in createThreadInternal() explains why this object should not be leaking.
Note You need to log in before you can comment on or make changes to this bug.