4 ms·
The author wrote a really short code snippet that demonstrates the problem: function f() { var some = []; while(some.length < 1e6) { some.push(
by i_s 13y 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 https://s3.amazonaws.com/chromebugs/memory.html
- e12e 13y agoSo well that it crashed/froze icweasel...