Simple jQuery Ajax call leaks memory in Internet Explorer

Here’s a link to the bug over on jQuery, along with this as a suggested fix for jQuery 1.4.2:

--- jquery-1.4.2.js     2010-04-08 12:10:20.000000000 -0700
+++ jquery-1.4.2.js.fixed       2010-04-08 12:10:38.000000000 -0700
@@ -5219,7 +5219,7 @@

                            // Stop memory leaks
                            if ( s.async ) {
-                                       xhr = null;
+                                       xhr.onreadystatechange = null; xhr.abort = null; xhr = null;
                            }
                    }
            };

NOTE: This is officially fixed in jQuery 1.4.4, so your best bet is to just upgrade now.

Leave a Comment