console-shim
console-shim copied to clipboard
Memory leak fix
The following is a memory leak fix that occurs in some browsers when refreshing.
Cheers, Jose
Klaus Reimer » console-shim #13 SUCCESS This pull request looks good (what's this?)
I'm unaffiliated with this project, but I'm curious to know how using window
inside (function() { ... })()
causes a memory leak and replacing it with (function(global) { ... })(window)
fixes it?
@cpburnz as far as I understand it, the problematic part is:
var console = (/** @type {Object} */ window.console);
Some versions of IE can't dereference the "console" var, thus leaking it.
I don't think using window from the globals arg or directly does make any difference as far as the leak itself is concerned, though.
@dmp42 I'm not sure what dereferencing means in the context of Javascript. So by running:
var console = window.console;
That causes IE to leak its reference to the console object which persists between page reloads?
Yes, doing so inside a closure may cause certain IE versions to not free the object between page results.
Why was it not merged?