Memory Leak with an XMLHttpRequest and setInterval

前端 未结 3 716
迷失自我
迷失自我 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:14

    In the first one, you're instantiating a new XMLHttpRequest object on each call to the iterator function. The request objects will stick around at least until the HTTP requests complete. Initiating 200 HTTP requests per second is going to clog the browser up something fierce, since it won't actually perform all the requests; there's a limit to how many concurrent connections it'll open.

提交回复
热议问题