thanhlong203 / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

Detect memory leaks in goog.exportPath_ #333

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The tool detected memory leak in goog.exportPath_ with IE6 when I compile with 
ADVANCED_OPTIMIZATIONS.
http://blogs.msdn.com/b/gpde/archive/2009/08/03/javascript-memory-leak-detector-
v2.aspx

I think that circular reference has been generated by window and goog like this 
code.

 goog.exportSymbol('goog.dom.getElement', goog.dom.getElement);

This is roughly equivalent to the following codes.

 window.execScript('var goog');
 window['goog'] = {};
 window['goog']['dom'] = {};
 window['goog']['dom']['getElement'] = $goog$$dom$$getElement$;

The tool was not detected by the following codes.

 window.execScript('var goog = {}');
 window['goog']['dom'] = {};
 window['goog']['dom']['getElement'] = $goog$$dom$$getElement$;

I attach patch file.
Because the name of the temp variable is fixation, it might be not good.

Original issue reported on code.google.com by uchida...@gmail.com on 2 Jun 2011 at 3:41

Attachments:

GoogleCodeExporter commented 8 years ago
Is it a real issue?
goog.dom.getElement is defined once, and is never supposed to be removed from 
the global namespace (window).
Circular dependency != memory leak.

Original comment by pall...@google.com on 3 Jun 2011 at 3:05

GoogleCodeExporter commented 8 years ago
I don't understand a detailed condition.
Though if the exported function has the reference to window (or goog.global), 
it seems to make a circular reference.

Original comment by uchida...@gmail.com on 6 Jun 2011 at 2:59

GoogleCodeExporter commented 8 years ago
Such circular references are broken by IE7 when the user navigates away from 
the page.

Since IE6 is officially marked obsolete by Microsoft, Closure developers only 
fix serious issues on that browser.

Original comment by pall...@google.com on 6 Jun 2011 at 9:37

GoogleCodeExporter commented 8 years ago
Not fixing issues for IE6.

Original comment by nn...@google.com on 9 May 2012 at 10:19