kayahr / console-shim

Browser console compatibility shim for legacy JavaScript engines
MIT License
86 stars 16 forks source link

Memory leak fix #8

Open jbadeau opened 11 years ago

jbadeau commented 11 years ago

The following is a memory leak fix that occurs in some browsers when refreshing.

Cheers, Jose

buildhive commented 11 years ago

Klaus Reimer » console-shim #13 SUCCESS This pull request looks good (what's this?)

cpburnz commented 10 years ago

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?

dmp42 commented 10 years ago

@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.

cpburnz commented 10 years ago

@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?

dmp42 commented 10 years ago

Yes, doing so inside a closure may cause certain IE versions to not free the object between page results.

evil-shrike commented 7 years ago

Why was it not merged?