你真的了解内存泄露吗?

var theThing = null;
var replaceThing = function() {
  var originalThing = theThing
  var unused = function() {
    if (originalThing)
      console.log("hi")
  }

  theThing = {
    ongStr: new Array(1000000).join('*'),
    someMethod: function() {
      console.log(someMessage)
    }
  };
};
setInterval(replaceThing, 1000);

原文地址:https://www.cnblogs.com/honghong87/p/6906673.html