Bug 39973 - Memory Leak: The main resource of page is not free.
Summary: Memory Leak: The main resource of page is not free.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P1 Critical
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-31 18:06 PDT by genhua.liu
Modified: 2010-06-01 12:21 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description genhua.liu 2010-05-31 18:06:32 PDT
The leak is happen in ./WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp:
void FrameLoadedrClient::dispatchDidFinishLoading(...)

if(!coreResource)
    coreResource = loader->mainResource().releaseRef();

should be as following:

if(!coreResource)
    coreResource = loader->mainResource();

Otherwise, the reference count of coreResource is 2 at this point. And the main resource will not freed in this case.
Comment 1 Xan Lopez 2010-06-01 11:56:27 PDT
(In reply to comment #0)
> The leak is happen in ./WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp:
> void FrameLoadedrClient::dispatchDidFinishLoading(...)
> 
> if(!coreResource)
>     coreResource = loader->mainResource().releaseRef();
> 
> should be as following:
> 
> if(!coreResource)
>     coreResource = loader->mainResource();
> 
> Otherwise, the reference count of coreResource is 2 at this point. And the main resource will not freed in this case.

If I recall the refptr stuff correctly, I think this is right. The object is created with 1 reference, then it's increased to 2 for the return value. As we leak the ref with releaseRef(), it's never decreased to 1 when assigned. Is this what you had in mind?
Comment 2 Xan Lopez 2010-06-01 12:21:44 PDT
Pushed as r60498