I am making an AJAX request for XML. I am doing this every second. I notice that my memory usage grows into the hundreds of megabytes. As you might imagine, the customer is
Your timeout function
setTimeout(self.timeoutHandler, 750);
may be causing memory leak. Although the success: callback is able to exit after finished, there may not be an empty context in a setTimeout callback causing a circular loop. Youl should take out the anonymous function to end up something like this:
var pManager = new PageManager ();
pManager.timeoutHandler();
function PageManager () {
var ret = (function(self) {
return function() { self.timeoutHandler(); };
})(this);
this.timeoutHandler = function () {
$.ajax ({
url: '/echo/json/',
type: 'post',
cache: false,
success: function (data) {
setTimeout (ret, 750);
}
});
};
}
This should only call back once.