Bug Tracker

Opened 11 years ago

Closed 11 years ago

#3962 closed bug (fixed)

$.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 );
       }
};

Change History (2)

comment:1 Changed 11 years ago by john

Owner: set to john

comment:2 Changed 11 years ago by john

Resolution: fixed
Status: newclosed

Fixed in SVN rev [6179].

Note: See TracTickets for help on using tickets.