Bug 85889

Summary: [EFL] Memory leaks found in EFL DRT
Product: WebKit Reporter: Sudarsana Nagineni (babu) <naginenis>
Component: WebKit EFLAssignee: Sudarsana Nagineni (babu) <naginenis>
Status: RESOLVED FIXED    
Severity: Normal CC: gustavo, gyuyoung.kim, lucas.de.marchi, mrobinson, rakuco, tonikitoo, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch none

Description Sudarsana Nagineni (babu) 2012-05-08 09:15:14 PDT
Valgrind report memory leaks. It seems JSString created with JSStringCreateWithUTF8CString needs to be released explicitly or use JSRetainPtr

==19762== 22 bytes in 1 blocks are indirectly lost in loss record 826 of 6,796
==19762==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19762==    by 0x55F1AEA: WTF::fastMalloc(unsigned long) (FastMalloc.cpp:268)
==19762==    by 0x532FE08: OpaqueJSString::OpaqueJSString(unsigned short const*, unsigned int) (FastMalloc.h:269)
==19762==    by 0x532FD3D: OpaqueJSString::create(unsigned short const*, unsigned int) (OpaqueJSString.h:46)
==19762==    by 0x532FA3D: JSStringCreateWithUTF8CString (JSStringRef.cpp:50)
==19762==    by 0x463660: DumpRenderTreeChrome::onWindowObjectCleared(void*, _Evas_Object*, void*) (DumpRenderTreeChrome.cpp:364)
==19762==    by 0x4E794F2: evas_object_smart_callback_call (evas_object_smart.c:460)
==19762==    by 0xBFE3CDF: WebCore::FrameLoaderClientEfl::dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*) (FrameLoaderClientEfl.cpp:437)
==19762==    by 0x88FE87A: WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*) (FrameLoader.cpp:3101)
==19762==    by 0x900C0F8: WebCore::ScriptController::initScript(WebCore::DOMWrapperWorld*) (ScriptController.cpp:223)
==19762==    by 0x83DDCAC: WebCore::ScriptController::windowShell(WebCore::DOMWrapperWorld*) (ScriptController.h:75)
==19762==    by 0x900BB06: WebCore::ScriptController::evaluateInWorld(WebCore::ScriptSourceCode const&, WebCore::DOMWrapperWorld*) (ScriptController.cpp:131)
==19762==    by 0x900BD31: WebCore::ScriptController::evaluate(WebCore::ScriptSourceCode const&) (ScriptController.cpp:162)
==19762==    by 0x862DC8B: WebCore::ScriptElement::executeScript(WebCore::ScriptSourceCode const&) (ScriptElement.cpp:290)
==19762==    by 0x87CB633: WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent(WebCore::PendingScript&) (HTMLScriptRunner.cpp:139)
==19762==    by 0x87CB489: WebCore::HTMLScriptRunner::executeParsingBlockingScript() (HTMLScriptRunner.cpp:118)
==19762==    by 0x87CB9F2: WebCore::HTMLScriptRunner::executeParsingBlockingScripts() (HTMLScriptRunner.cpp:195)
==19762==    by 0x87CBB69: WebCore::HTMLScriptRunner::executeScriptsWaitingForLoad(WebCore::CachedResource*) (HTMLScriptRunner.cpp:206)
==19762==    by 0x87BF755: WebCore::HTMLDocumentParser::notifyFinished(WebCore::CachedResource*) (HTMLDocumentParser.cpp:517)
==19762==    by 0x89590D3: WebCore::CachedResource::checkNotify() (CachedResource.cpp:248)
==19762==    by 0x896A5CE: WebCore::CachedScript::data(WTF::PassRefPtr<WebCore::SharedBuffer>, bool) (CachedScript.cpp:104)
==19762==    by 0x8924364: WebCore::SubresourceLoader::didFinishLoading(double) (SubresourceLoader.cpp:276)
==19762==    by 0x8920772: WebCore::ResourceLoader::didFinishLoading(WebCore::ResourceHandle*, double) (ResourceLoader.cpp:435)
==19762==    by 0x93E6B4A: WebCore::readCallback(_GObject*, _GAsyncResult*, void*) (ResourceHandleSoup.cpp:864)
==19762==    by 0xECC9DE4: async_ready_callback_wrapper (ginputstream.c:470)
==19762==    by 0xECDB80C: g_simple_async_result_complete (gsimpleasyncresult.c:744)
==19762==    by 0xECDB8A7: complete_in_idle_cb_for_thread (gsimpleasyncresult.c:812)
==19762==    by 0xD677FC9: g_main_context_dispatch (gmain.c:2513)
==19762==    by 0x414C5E0: _ecore_glib_select (ecore_glib.c:171)
==19762==    by 0x41469AC: _ecore_main_select (ecore_main.c:1419)
==19762==    by 0x4147444: _ecore_main_loop_iterate_internal (ecore_main.c:1835)
==19762==    by 0x4147726: ecore_main_loop_begin (ecore_main.c:906)
==19762==    by 0x45F895: runTest(char const*) (DumpRenderTree.cpp:248)
==19762==    by 0x46009A: main (DumpRenderTree.cpp:411)


==19762== 240 bytes in 20 blocks are indirectly lost in loss record 5,852 of 6,796
==19762==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19762==    by 0x55F1AEA: WTF::fastMalloc(unsigned long) (FastMalloc.cpp:268)
==19762==    by 0x532FE08: OpaqueJSString::OpaqueJSString(unsigned short const*, unsigned int) (FastMalloc.h:269)
==19762==    by 0x532FD3D: OpaqueJSString::create(unsigned short const*, unsigned int) (OpaqueJSString.h:46)
==19762==    by 0x532FA3D: JSStringCreateWithUTF8CString (JSStringRef.cpp:50)
==19762==    by 0x469CCC: modifiersFromJSValue(OpaqueJSContext const*, OpaqueJSValue const*) (EventSender.cpp:228)
==19762==    by 0x46AA27: createKeyEventInfo(OpaqueJSContext const*, unsigned long, OpaqueJSValue const* const*, OpaqueJSValue const**) (EventSender.cpp:441)
==19762==    by 0x46AC73: keyDownCallback(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSValue*, unsigned long, OpaqueJSValue const* const*, OpaqueJSValue const**) (EventSender.cpp:468)
==19762==    by 0x5311DA3: JSC::JSCallbackFunction::call(JSC::ExecState*) (JSCallbackFunction.cpp:73)
==19762==    by 0x549F5C5: cti_op_call_NotJSFunction (JITStubs.cpp:2312)
==19762==    by 0x549AD77: JSC::JITThunks::tryCacheGetByID(JSC::ExecState*, JSC::CodeBlock*, JSC::ReturnAddressPtr, JSC::JSValue, JSC::Identifier const&, JSC::PropertySlot const&, JSC::StructureStubInfo*)
==19762==    by 0x7FEFFE0EF: ???
Comment 1 Sudarsana Nagineni (babu) 2012-05-08 09:26:30 PDT
Created attachment 140728 [details]
patch

Fix memory leaks.
Comment 2 Raphael Kubo da Costa (:rakuco) 2012-05-09 12:35:50 PDT
Comment on attachment 140728 [details]
patch

Looks good, thanks.
Comment 3 Gyuyoung Kim 2012-05-09 21:53:45 PDT
Comment on attachment 140728 [details]
patch

Looks fine as well.
Comment 4 WebKit Review Bot 2012-05-10 06:42:10 PDT
Comment on attachment 140728 [details]
patch

Clearing flags on attachment: 140728

Committed r116638: <http://trac.webkit.org/changeset/116638>
Comment 5 WebKit Review Bot 2012-05-10 06:42:15 PDT
All reviewed patches have been landed.  Closing bug.