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; | |
| // Define um encerramento que faz referência a originalThing, mas nunca | |
| // é realmente chamado. Mas, como esse encerramento existe, | |
| // originalThing estará no ambiente léxico para todos | |
| // os encerramentos definidos em replaceThing, em vez de ser otimizado | |
| // a partir dele. Se você remover esta função, não haverá vazamento. | |
| var unused = function() { | |
| if (originalThing) |
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() { |