<?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>135638</bug_id>
          
          <creation_ts>2014-08-05 20:38:09 -0700</creation_ts>
          <short_desc>HashTable based classes leak a lot</short_desc>
          <delta_ts>2014-08-10 01:45:46 -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>New Bugs</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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Benjamin Poulain">benjamin</reporter>
          <assigned_to name="Benjamin Poulain">benjamin</assigned_to>
          <cc>cmarcelo</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1027074</commentid>
    <comment_count>0</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-08-05 20:38:09 -0700</bug_when>
    <thetext>HashTable based classes leak a lot</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1027076</commentid>
    <comment_count>1</comment_count>
      <attachid>236078</attachid>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-08-05 20:43:55 -0700</bug_when>
    <thetext>Created attachment 236078
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1027078</commentid>
    <comment_count>2</comment_count>
      <attachid>236078</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-08-05 20:48:07 -0700</bug_when>
    <thetext>Comment on attachment 236078
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=236078&amp;action=review

Another fix would be to just add these two lines:

    if (m_table)
        deallocateTable(m_table, m_tableSize);

I suppose the swap idiom is more elegant, but it would be nice to double check that it’s just as efficient too.

&gt; Source/WTF/wtf/HashTable.h:1236
&gt; +        HashTable&lt;Key, Value, Extractor, HashFunctions, Traits, KeyTraits&gt; temp = WTF::move(other);

You could write just HashTable here or just auto. No need for that long HashTable&lt;xxxxxxxx&gt; thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1027087</commentid>
    <comment_count>3</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-08-05 22:15:09 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 236078 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=236078&amp;action=review
&gt; 
&gt; Another fix would be to just add these two lines:
&gt; 
&gt;     if (m_table)
&gt;         deallocateTable(m_table, m_tableSize);
&gt; 
&gt; I suppose the swap idiom is more elegant, but it would be nice to double check that it’s just as efficient too.

The previous version does not look like it was written to be efficient. It is zeroing the attributes that depends on the table being non null.

...but I&apos;ll check.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1027270</commentid>
    <comment_count>4</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-08-06 13:08:17 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; (From update of attachment 236078 [details] [details])
&gt; &gt; View in context: https://bugs.webkit.org/attachment.cgi?id=236078&amp;action=review
&gt; &gt; 
&gt; &gt; Another fix would be to just add these two lines:
&gt; &gt; 
&gt; &gt;     if (m_table)
&gt; &gt;         deallocateTable(m_table, m_tableSize);
&gt; &gt; 
&gt; &gt; I suppose the swap idiom is more elegant, but it would be nice to double check that it’s just as efficient too.
&gt; 
&gt; The previous version does not look like it was written to be efficient. It is zeroing the attributes that depends on the table being non null.
&gt; 
&gt; ...but I&apos;ll check.

Ok, tried both on x86_64, the version with &quot;if (m_table)&quot; is significantly worse than the swap().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1027271</commentid>
    <comment_count>5</comment_count>
      <attachid>236078</attachid>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-08-06 13:12:34 -0700</bug_when>
    <thetext>Comment on attachment 236078
Patch

Clearing flags on attachment: 236078

Committed r172167: &lt;http://trac.webkit.org/changeset/172167&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1027272</commentid>
    <comment_count>6</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-08-06 13:12:37 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1027861</commentid>
    <comment_count>7</comment_count>
      <attachid>236078</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-08-08 09:33:22 -0700</bug_when>
    <thetext>Comment on attachment 236078
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=236078&amp;action=review

&gt;&gt; Source/WTF/wtf/HashTable.h:1236
&gt;&gt; +        HashTable&lt;Key, Value, Extractor, HashFunctions, Traits, KeyTraits&gt; temp = WTF::move(other);
&gt; 
&gt; You could write just HashTable here or just auto. No need for that long HashTable&lt;xxxxxxxx&gt; thing.

Did you see this comment? I noticed you landed it with the long thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1027961</commentid>
    <comment_count>8</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-08-08 14:57:03 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; (From update of attachment 236078 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=236078&amp;action=review
&gt; 
&gt; &gt;&gt; Source/WTF/wtf/HashTable.h:1236
&gt; &gt;&gt; +        HashTable&lt;Key, Value, Extractor, HashFunctions, Traits, KeyTraits&gt; temp = WTF::move(other);
&gt; &gt; 
&gt; &gt; You could write just HashTable here or just auto. No need for that long HashTable&lt;xxxxxxxx&gt; thing.
&gt; 
&gt; Did you see this comment? I noticed you landed it with the long thing.

I am one of the dinosaurs who find code a lot harder to read with &quot;auto&quot; :)

If you feel strongly about it, I&apos;ll update to auto.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028025</commentid>
    <comment_count>9</comment_count>
      <attachid>236078</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-08-08 17:44:31 -0700</bug_when>
    <thetext>Comment on attachment 236078
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=236078&amp;action=review

&gt;&gt;&gt;&gt; Source/WTF/wtf/HashTable.h:1236
&gt;&gt;&gt;&gt; +        HashTable&lt;Key, Value, Extractor, HashFunctions, Traits, KeyTraits&gt; temp = WTF::move(other);
&gt;&gt;&gt; 
&gt;&gt;&gt; You could write just HashTable here or just auto. No need for that long HashTable&lt;xxxxxxxx&gt; thing.
&gt;&gt; 
&gt;&gt; Did you see this comment? I noticed you landed it with the long thing.
&gt; 
&gt; I am one of the dinosaurs who find code a lot harder to read with &quot;auto&quot; :)
&gt; 
&gt; If you feel strongly about it, I&apos;ll update to auto.

Since you don’t like auto, you can do this:

    HashTable temp = WTF::move(other);

To me it reads even better with auto, but I understand that you don’t like it. That’s why I said “just HashTable” *or* “just auto”.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028028</commentid>
    <comment_count>10</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-08-08 18:00:09 -0700</bug_when>
    <thetext>(In reply to comment #9)
&gt; (From update of attachment 236078 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=236078&amp;action=review
&gt; 
&gt; &gt;&gt;&gt;&gt; Source/WTF/wtf/HashTable.h:1236
&gt; &gt;&gt;&gt;&gt; +        HashTable&lt;Key, Value, Extractor, HashFunctions, Traits, KeyTraits&gt; temp = WTF::move(other);
&gt; &gt;&gt;&gt; 
&gt; &gt;&gt;&gt; You could write just HashTable here or just auto. No need for that long HashTable&lt;xxxxxxxx&gt; thing.
&gt; &gt;&gt; 
&gt; &gt;&gt; Did you see this comment? I noticed you landed it with the long thing.
&gt; &gt; 
&gt; &gt; I am one of the dinosaurs who find code a lot harder to read with &quot;auto&quot; :)
&gt; &gt; 
&gt; &gt; If you feel strongly about it, I&apos;ll update to auto.
&gt; 
&gt; Since you don’t like auto, you can do this:
&gt; 
&gt;     HashTable temp = WTF::move(other);
&gt; 
&gt; To me it reads even better with auto, but I understand that you don’t like it. That’s why I said “just HashTable” *or* “just auto”.

Oh, I misunderstood the part about HashTable. I agree HashTable is better, I will update.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028087</commentid>
    <comment_count>11</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-08-10 01:45:46 -0700</bug_when>
    <thetext>Fixed the type in r172378: &lt;http://trac.webkit.org/changeset/172378&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>236078</attachid>
            <date>2014-08-05 20:43:55 -0700</date>
            <delta_ts>2014-08-08 17:44:31 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-135638-20140805204336.patch</filename>
            <type>text/plain</type>
            <size>2255</size>
            <attacher name="Benjamin Poulain">benjamin</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTcyMDkzCmRpZmYgLS1naXQgYS9Tb3VyY2UvV1RGL0NoYW5n
ZUxvZyBiL1NvdXJjZS9XVEYvQ2hhbmdlTG9nCmluZGV4IDVlZWU5NDNkNjU1Y2NjNWY5NGY0M2Y1
MTZhNDNlYTA3M2NlY2E5Y2MuLjA4NDI3OWZkN2ZkMmI1NGFjMDQwYjllYzE0N2MyYjdiZGEyMDYy
YzMgMTAwNjQ0Ci0tLSBhL1NvdXJjZS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sZXRlZENvdW50ID0gb3RoZXIubV9kZWxldGVkQ291bnQ7Ci0KLSAgICAgICAgb3RoZXIubV90
YWJsZSA9IG51bGxwdHI7Ci0gICAgICAgIG90aGVyLm1fdGFibGVTaXplID0gMDsKLSAgICAgICAg
b3RoZXIubV90YWJsZVNpemVNYXNrID0gMDsKLSAgICAgICAgb3RoZXIubV9rZXlDb3VudCA9IDA7
Ci0gICAgICAgIG90aGVyLm1fZGVsZXRlZENvdW50ID0gMDsKLQotI2lmIERVTVBfSEFTSFRBQkxF
X1NUQVRTX1BFUl9UQUJMRQotICAgICAgICBtX3N0YXRzID0gV1RGOjptb3ZlKG90aGVyLm1fc3Rh
dHMpOwotICAgICAgICBvdGhlci5tX3N0YXRzID0gbnVsbHB0cjsKLSNlbmRpZgotCisgICAgICAg
IEhhc2hUYWJsZTxLZXksIFZhbHVlLCBFeHRyYWN0b3IsIEhhc2hGdW5jdGlvbnMsIFRyYWl0cywg
S2V5VHJhaXRzPiB0ZW1wID0gV1RGOjptb3ZlKG90aGVyKTsKKyAgICAgICAgc3dhcCh0ZW1wKTsK
ICAgICAgICAgcmV0dXJuICp0aGlzOwogICAgIH0KIAo=
</data>

          </attachment>
      

    </bug>

</bugzilla>