tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

grow-large-array.js (308B)


      1 // |jit-test| allow-oom
      2 
      3 // Exercise growing a very large array.
      4 
      5 const growBy = 100000;
      6 const startSize = 1 * 1024 * 1024;
      7 const endSize = 32 * 1024 * 1024;
      8 
      9 const array = new Array();
     10 array.fill(1);
     11 const extra = new Array(growBy);
     12 extra.fill(1);
     13 while (array.length < endSize) {
     14  array.push(...extra);
     15 }