Simple jQuery Ajax call leaks memory in Internet Explorer

后端 未结 8 817
小鲜肉
小鲜肉 2020-12-02 20:33

I created a web page that makes an Ajax call every second. In Internet Explorer 7, it leaks memory badly (20 MB in about 15 minutes).

The program is very simple. It

8条回答
  •  日久生厌
    2020-12-02 20:49

    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.

提交回复
热议问题