<?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>114824</bug_id>
          
          <creation_ts>2013-04-18 13:05:49 -0700</creation_ts>
          <short_desc>Garbage Collection of Typed Arrays Fails</short_desc>
          <delta_ts>2013-07-24 14:55:52 -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>Mac (Intel)</rep_platform>
          <op_sys>OS X 10.8</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>119064</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Amit Kapadia">amit</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>feross</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>mhahnenberg</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>878036</commentid>
    <comment_count>0</comment_count>
      <attachid>198755</attachid>
    <who name="Amit Kapadia">amit</who>
    <bug_when>2013-04-18 13:05:49 -0700</bug_when>
    <thetext>Created attachment 198755
Example of typed array initialization and failure of garbage collector.

Steps to reproduce the problem:

1. Define a function that initializes a typed array.
2. Execute the function.
3. Observe the typed array not being garbage collected when falling out of scope.

The garbage collector should release memory from all variables defined in the function closure.  Memory associated with the typed array is not released at any point during the life cycle of the web app.  Memory is not released on tab close, but only on application close.

Additionally, allocating a typed array seems to consume more memory than it should.  For example,

var arr = new Float32Array(268435456);

allocates 1 gigabyte for array storage; however, WebKit consumes ~4 GB.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>878783</commentid>
    <comment_count>1</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2013-04-20 11:32:57 -0700</bug_when>
    <thetext>Check on a webkit nightly, my testing shows this as fixed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>879161</commentid>
    <comment_count>2</comment_count>
    <who name="Amit Kapadia">amit</who>
    <bug_when>2013-04-22 08:20:51 -0700</bug_when>
    <thetext>Oliver, what type of tests did you conduct?

This is still an open issue on my end (using WebKit nightly).  If you open the Activity Monitor, you will see 500 MB allocated by &quot;SafariForWebKitDevelopment Web Content&quot;.  This memory is not released until the application closes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>883076</commentid>
    <comment_count>3</comment_count>
    <who name="Amit Kapadia">amit</who>
    <bug_when>2013-04-30 07:50:47 -0700</bug_when>
    <thetext>This bug also exists when initializing instances of ArrayBuffer.  Webkit nightly does not release memory until the application closes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>911367</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2013-07-24 11:12:48 -0700</bug_when>
    <thetext>See also: bug 119049.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>911437</commentid>
    <comment_count>5</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2013-07-24 14:55:52 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 119064 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>198755</attachid>
            <date>2013-04-18 13:05:49 -0700</date>
            <delta_ts>2013-04-18 13:05:49 -0700</delta_ts>
            <desc>Example of typed array initialization and failure of garbage collector.</desc>
            <filename>index.html</filename>
            <type>text/html</type>
            <size>638</size>
            <attacher name="Amit Kapadia">amit</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgogIDx0aXRsZT5NZW1vcnkgVGVzdDwvdGl0bGU+CiAgPHNjcmlwdCB0eXBl
PSd0ZXh0L2phdmFzY3JpcHQnPgogIChmdW5jdGlvbigpIHsKICAgIHZhciBBbGxvY2F0ZSwgYTsK
ICAgIAogICAgQWxsb2NhdGUgPSAoZnVuY3Rpb24oKSB7CiAgICAgIAogICAgICBmdW5jdGlvbiBB
bGxvY2F0ZSgpIHsKICAgICAgICB2YXIgaTsKICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAg
ICAgIGZvciAoaSA9IDA7IGkgPCA5OyBpICs9IDEpIHsKICAgICAgICAgIAogICAgICAgICAgLy8g
QWxsb2NhdGUgNTAgTUIgKDEzMTA3MjAwIGVsZW1lbnRzIG9mIDQgYnl0ZXMgZWFjaCkKICAgICAg
ICAgIHRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSgxMzEwNzIwMCkpOwogICAgICAg
IH0KICAgICAgICAKICAgICAgICAvLyBBdCB0aGlzIHBvaW50IDEwMDAgTUIgaGF2ZSBiZWVuIGFs
bG9jYXRlZC4KICAgICAgfQogICAgICAKICAgICAgcmV0dXJuIEFsbG9jYXRlOwogICAgICAKICAg
IH0pKCk7CiAgICAKICAgIGEgPSBuZXcgQWxsb2NhdGUoKTsKICAgIAogIH0pLmNhbGwodGhpcyk7
CiAgPC9zY3JpcHQ+CjwvaGVhZD4KCjxib2R5PgogIDxoND5NZW1vcnkgVGVzdDwvaDQ+CjwvYm9k
eT4KCjwvaHRtbD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>