Hacker News new | ask | show | jobs
by i_s 4596 days ago
The author wrote a really short code snippet that demonstrates the problem:

  function f() {
    var some = [];
    while(some.length < 1e6) {
      some.push(some.length);
    }
    function g() { some; } //removing this fixes a massive memory leak
    return function() {};    //or removing this
  }
If you keep a reference to the results of calling this function, it will keep a reference to the "some" variable, even though it is not needed.

He created a page that demonstrates the problem here:

https://s3.amazonaws.com/chromebugs/memory.html

1 comments

So well that it crashed/froze icweasel...