<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>144721</bug_id>
          
          <creation_ts>2015-05-06 18:06:35 -0700</creation_ts>
          <short_desc>Worker threads leak WeakBlocks (as seen on leaks bot)</short_desc>
          <delta_ts>2015-05-07 11:33:55 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Performance</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andreas Kling">kling</reporter>
          <assigned_to name="Andreas Kling">kling</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>ggaren</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1092432</commentid>
    <comment_count>0</comment_count>
    <who name="Andreas Kling">kling</who>
    <bug_when>2015-05-06 18:06:35 -0700</bug_when>
    <thetext>&lt;rdar://problem/20848288&gt;

We&apos;ve got about 750 KB worth of WeakBlocks leaked on the leaks bot right now. Boo.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1092434</commentid>
    <comment_count>1</comment_count>
      <attachid>252547</attachid>
    <who name="Andreas Kling">kling</who>
    <bug_when>2015-05-06 18:10:58 -0700</bug_when>
    <thetext>Created attachment 252547
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1092609</commentid>
    <comment_count>2</comment_count>
      <attachid>252547</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2015-05-07 09:25:11 -0700</bug_when>
    <thetext>Comment on attachment 252547
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!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1092638</commentid>
    <comment_count>3</comment_count>
    <who name="Andreas Kling">kling</who>
    <bug_when>2015-05-07 10:42:41 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Comment on attachment 252547 [details]
&gt; Patch
&gt; 
&gt; I think we return here and use std::unique_ptr for this. It would remove the
&gt; need to explicitly call WeakBlock::destroy in
&gt; Heap::sweepNextLogicallyEmptyWeakBlock. I know this is low-level code and
&gt; std::unique_ptr might seem out of place, but I think it would cleanly
&gt; prevent a mistake like this one!

That&apos;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&apos;re just plain fastMalloc()&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1092644</commentid>
    <comment_count>4</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2015-05-07 11:02:58 -0700</bug_when>
    <thetext>&gt; I think we return here and use std::unique_ptr for this. It would remove the
&gt; need to explicitly call WeakBlock::destroy in
&gt; Heap::sweepNextLogicallyEmptyWeakBlock. I know this is low-level code and
&gt; std::unique_ptr might seem out of place, but I think it would cleanly
&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1092667</commentid>
    <comment_count>5</comment_count>
      <attachid>252547</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2015-05-07 11:33:51 -0700</bug_when>
    <thetext>Comment on attachment 252547
Patch

Clearing flags on attachment: 252547

Committed r183938: &lt;http://trac.webkit.org/changeset/183938&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1092668</commentid>
    <comment_count>6</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2015-05-07 11:33:55 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>252547</attachid>
            <date>2015-05-06 18:10:58 -0700</date>
            <delta_ts>2015-05-07 11:33:51 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-144721.diff</filename>
            <type>text/plain</type>
            <size>1244</size>
            <attacher name="Andreas Kling">kling</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cgYi9Tb3VyY2UvSmF2
YVNjcmlwdENvcmUvQ2hhbmdlTG9nCmluZGV4IDNlNTM5ZjguLjEwYWUyNmEgMTAwNjQ0Ci0tLSBh
L1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKKysrIGIvU291cmNlL0phdmFTY3JpcHRD
b3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE5IEBACisyMDE1LTA1LTA2ICBBbmRyZWFzIEtsaW5n
ICA8YWtsaW5nQGFwcGxlLmNvbT4KKworICAgICAgICBXb3JrZXIgdGhyZWFkcyBsZWFrIFdlYWtC
bG9ja3MgKGFzIHNlZW4gb24gbGVha3MgYm90KQorICAgICAgICA8aHR0cHM6Ly93ZWJraXQub3Jn
L2IvMTQ0NzIxPgorICAgICAgICA8cmRhcjovL3Byb2JsZW0vMjA4NDgyODg+CisKKyAgICAgICAg
UmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgTnVrZSBhbnkgcmVtYWluaW5n
I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