Created
May 27, 2019 07:16
-
-
Save AndrewBuntsev/e1f974ccf57b5da1eb77070a546935c7 to your computer and use it in GitHub Desktop.
JavaScript string 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
<html> | |
<body> | |
<script> | |
function createString() { | |
return "0".repeat(25 * 1024 * 1024).substring(0, 11); | |
} | |
var arr = []; | |
setInterval(function() { | |
let str = createString(); | |
arr.push(str); | |
}, 500); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment