I already had some problems when I was using jQuery 1.4.2 (http://stackoverflow.com/questions/8158739/ie-memory-leak-and-eval-with-jquery/8176724#8176724)
Now I've updated my jQuery to version 1.7.1, and I have the memory increasing slowly after each iteration.
This is the code I have:
var interval;
function setupdaterate(rate) {
//if the interval wasn't defined only
if (interval == undefined) {
interval = setInterval(updateitems, rate * 1000);
}
}
function updateitems() {
$('.updatable').each(function () {
var data = 'ViewObjectId=' + $(this).attr('objectid');
$.ajax({
async: true,
url: '/Ajax/GetUpdatedViewObjectDataHandler.ashx',
data: data,
type: 'POST',
timeout: 10000
}).done(function (data) {
//do the job
});
});
}
After 10 seconds all item with the class "updatable" are updated. But for some reason this code leaks some memory.
Is it the best way of using jquery ajax? What could be causing the memory leak behaviour?
How could I figure out where is the problem? Any advice?