Last active
May 4, 2019 09:54
-
-
Save mr-parus/6d621c3e9f595cdbe9fd5d274adad43a to your computer and use it in GitHub Desktop.
[JS] Memory leak (https://auth0.com/blog/four-types-of-leaks-in-your-javascript-code-and-how-to-get-rid-of-them/)
This file contains hidden or 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