Created
September 8, 2020 00:26
-
-
Save daipeihust/9d14243d65f1484a3d524786f53dc8e3 to your computer and use it in GitHub Desktop.
Memory leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var theThing = null; | |
var replaceThing = function () { | |
var originalThing = theThing; | |
var unused = function () { | |
if (originalThing) | |
console.log("hi"); | |
}; | |
theThing = { | |
longStr: new Array(1000000).join('*'), | |
someMethod: function () { | |
console.log(someMessage); | |
} | |
}; | |
}; | |
setInterval(replaceThing, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment