Memory Leak with an XMLHttpRequest and setInterval

前端 未结 3 715
迷失自我
迷失自我 2021-01-21 02:57

Here\'s some code that I run on Google Chrome 19.0.1061.1 (Official Build 125213) dev:


Memory Leak


        
3条回答
  •  情歌与酒
    2021-01-21 03:20

    In your first example, you are calling a new instance of XMLHttpRequest() with each interval. In the second one, you instantiate a copy one time and use it throughout the life of the code. That's why in the first example you run out of memory.

提交回复
热议问题