Simple jQuery Ajax call leaks memory in Internet Explorer

后端 未结 8 812
小鲜肉
小鲜肉 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

    eval() will eat up memory for sure (eval happens when passing a string to setTimeout to evaluate), don't use it in testing:

    setTimeout('testJunk()',1000);
    

    should be:

    setTimeout(testJunk, 1000);
    

    Also a better use overall would be setInterval() for a repeated operation like you want, try this:

    setInterval(testJunk, 1000);
    

提交回复
热议问题