Side navigation
#3962 closed bug (fixed)
Opened January 22, 2009 07:36PM UTC
Closed February 07, 2009 04:58PM UTC
$.getScript leaks in IE
Reported by: | john | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.3.2 |
Component: | ajax | Version: | 1.3.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I've found and fixed a small memory leak in the jQuery 1.2.6 codebase
that pertains to the getScript ajax methods. (around line 2670 in
jQuery 1.2.6)
the new code is as follows - I added
script.onload = script.onreadystatechange = null;
right before the head.removeChild( script ); call to help IE collect
its garbage.
// Attach handlers for all browsers script.onload = script.onreadystatechange = function(){ if ( !done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) { done = true; success(); complete(); // handle memory leak in IE script.onload = script.onreadystatechange = null; head.removeChild( script ); } };