Bug 71259

Summary: Leaks seen in RenderRegion::setRenderBoxRegionInfo on Leaks bot
Product: WebKit Reporter: Adam Roben (:aroben) <aroben>
Component: Layout and RenderingAssignee: Mihnea Ovidenie <mihnea>
Severity: Normal CC: darin, hyatt, mihnea, mitz, simon.fraser, webkit-bug-importer, webkit.review.bot
Priority: P2 Keywords: InRadar, MakingBotsRed
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://build.webkit.org/LeaksViewer/?url=http%3A%2F%2Fbuild.webkit.org%2F%2Fresults%2FSnowLeopard%20Intel%20Leaks%2Fr98879%20(19849)%2F
Bug Depends on:    
Bug Blocks: 57312    
Description Flags
Patch none

Description Adam Roben (:aroben) 2011-10-31 17:57:23 PDT

malloc_zone_malloc > malloc > fastMalloc > RenderRegion::setRenderBoxRegionInfo

We're leaking in this function. Looks like we're allocating a new RenderBoxRegionInfo, storing it in a HashMap, and never deleting it.
Comment 1 Radar WebKit Bug Importer 2011-10-31 17:57:35 PDT
Comment 2 Darin Adler 2011-11-05 18:20:43 PDT
*** Bug 71260 has been marked as a duplicate of this bug. ***
Comment 3 Mihnea Ovidenie 2011-11-06 01:44:14 PST
I have taken a look at both methods RenderRegion::setRenderBoxRegionInfo and RenderFlowThread::setRegionRangeForBox. Using our current tests, i was not able to find a place where we leak in these functions and their associated data.

What i have found is that  in JavaScriptCore/Parser.cpp, Parser class destructor, we are not freeing the Lexer object that was allocated in the Parser ctor. I will make a patch with that fix unless there is a reason for doing that after https://bugs.webkit.org/show_bug.cgi?id=71138.
Comment 4 Mihnea Ovidenie 2011-11-06 10:29:46 PST
Leaks are reported if one loads fast/regions/overflow-in-uniform-regions-dynamic.html.
Comment 5 Mihnea Ovidenie 2011-11-06 12:23:40 PST
In RenderFlowThread::logicalWidthChangedInRegions, oldInfo is deleted only inside the condition:
if (!newInfo || newInfo->logicalWidth() != oldInfo->logicalWidth()) {

Otherwise, it is left undeleted and leaked.
Comment 6 Mihnea Ovidenie 2011-11-06 12:34:23 PST
The other leak is in function RenderRegion::removeRenderBoxRegionInfo, when the RenderBoxRegionInfo is removed from the map but not deleted.
Comment 7 Mihnea Ovidenie 2011-11-06 12:41:59 PST
I can make a patch for this one and another for 71260 if this is ok with you.
Comment 8 Darin Adler 2011-11-06 14:28:43 PST
Sure, if you want to handle this, that’s fine.
Comment 9 Mihnea Ovidenie 2011-11-07 04:51:08 PST
Created attachment 113846 [details]
Comment 10 WebKit Review Bot 2011-11-07 13:15:09 PST
Comment on attachment 113846 [details]

Clearing flags on attachment: 113846

Committed r99467: <http://trac.webkit.org/changeset/99467>
Comment 11 WebKit Review Bot 2011-11-07 13:15:14 PST
All reviewed patches have been landed.  Closing bug.