I am developing a google-chrome extension that has javascript code that is make xhr requests periodically. I realized that over time, the amount of RAM that the process took up started increasing. I am not sure if this is due to the fact that the xhr requests do not get garbage collected or if it is because google-chrome keeps the response of the xhr request and doesnt get rid of it. Here is some of my code:
var locationx = "http://www.example.com";
var ne开发者_运维知识库wxhrx = new XMLHttpRequest()
newxhrx.startedOn = new Date().getTime()
try {
newxhrx.open("GET", locationx, true)
newxhrx.followRedirects = false
newxhrx.send(null)
} catch(e1){
alert('No internet connection')
}
newxhrx = null;
locationx = null;
If I look at the "Network" section in the chrome developer tools. I see that the page is called multiple times and the responses do not get removed from this section. Is this problem due to a JavaScript memory leak or because of google-chrome saving the responses? Can this be fixed and how?
The growth of memory usage when working with AJAX calls is observed in other browsers as well.
http://forum.jquery.com/topic/memory-leaks-with-ajax-calls
http://code.google.com/p/chromium/issues/detail?id=52411
精彩评论