RESOLVED FIXED144721
Worker threads leak WeakBlocks (as seen on leaks bot)
https://bugs.webkit.org/show_bug.cgi?id=144721
Summary Worker threads leak WeakBlocks (as seen on leaks bot)
Andreas Kling
Reported 2015-05-06 18:06:35 PDT
<rdar://problem/20848288> We've got about 750 KB worth of WeakBlocks leaked on the leaks bot right now. Boo.
Attachments
Patch (1.21 KB, patch)
2015-05-06 18:10 PDT, Andreas Kling
no flags
Andreas Kling
Comment 1 2015-05-06 18:10:58 PDT
Darin Adler
Comment 2 2015-05-07 09:25:11 PDT
Comment on attachment 252547 [details] Patch I think we return here and use std::unique_ptr for this. It would remove the need to explicitly call WeakBlock::destroy in Heap::sweepNextLogicallyEmptyWeakBlock. I know this is low-level code and std::unique_ptr might seem out of place, but I think it would cleanly prevent a mistake like this one!
Andreas Kling
Comment 3 2015-05-07 10:42:41 PDT
(In reply to comment #2) > Comment on attachment 252547 [details] > Patch > > I think we return here and use std::unique_ptr for this. It would remove the > need to explicitly call WeakBlock::destroy in > Heap::sweepNextLogicallyEmptyWeakBlock. I know this is low-level code and > std::unique_ptr might seem out of place, but I think it would cleanly > prevent a mistake like this one! That's not a bad idea. I glossed over it because I assumed WeakBlocks were aligned to their block size, but it turns out that they're just plain fastMalloc()'ed objects. With a little care, we can fix these up to live in unique_ptr. Landing this right away to unscrew leaks bot though.
Geoffrey Garen
Comment 4 2015-05-07 11:02:58 PDT
> I think we return here and use std::unique_ptr for this. It would remove the > need to explicitly call WeakBlock::destroy in > Heap::sweepNextLogicallyEmptyWeakBlock. I know this is low-level code and > std::unique_ptr might seem out of place, but I think it would cleanly > prevent a mistake like this one! I agree. Once upon a time it was not practical to unique_ptr these objects, but now it should be pretty trivial.
WebKit Commit Bot
Comment 5 2015-05-07 11:33:51 PDT
Comment on attachment 252547 [details] Patch Clearing flags on attachment: 252547 Committed r183938: <http://trac.webkit.org/changeset/183938>
WebKit Commit Bot
Comment 6 2015-05-07 11:33:55 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.