<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - GC has trouble with pathologically large array allocations"
   href="https://bugs.webkit.org/show_bug.cgi?id=144609#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - GC has trouble with pathologically large array allocations"
   href="https://bugs.webkit.org/show_bug.cgi?id=144609">bug 144609</a>
              from <span class="vcard"><a class="email" href="mailto:fpizlo&#64;apple.com" title="Filip Pizlo &lt;fpizlo&#64;apple.com&gt;"> <span class="fn">Filip Pizlo</span></a>
</span></b>
        <pre>Consider the following test, if you tweak the size so that we actually allocate the memory.  It causes linear heap growth.


function foo(x) {
    return new Array(x);
}

noInline(foo);

function test(size) {
    var result = foo(size);
    if (result.length != size)
        throw &quot;Error: bad result: &quot; + result;
    var sawThings = false;
    for (var s in result)
        sawThings = true;
    if (sawThings)
        throw &quot;Error: array is in bad state: &quot; + result;
    result[0] = &quot;42.5&quot;;
    if (result[0] != &quot;42.5&quot;)
        throw &quot;Error: array is in wierd state: &quot; + result;
}

for (var i = 0; i &lt; 100000; ++i) {
    test(1000000);
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>