javascript - jQuery AJAX jsonp calling intervally cause memory leak -


i try intervally ajax calling using jquery ajax function using settimeout() in ajax complete callback, cause memory leak.

i think everytime callajax called, ajax object in jquery created , there recursive reference, created object cannot free.

what can avoiding memory leak?

var count = 0; var ajax = $.ajax; function callajax() {     ajax({         url: "http://192.168.137.1:8080/data.json",         datatype: "jsonp",         jsonpcallback: "abc",         success: function(data) {             document.getelementbyid('result').innerhtml = json.stringify(data, null, 4) + '<br>' + count;         },         error: function(e) {             console.error(e);         },         complete: function() {                         count++;             settimeout(callajax, 1000); // maybe cause memory leak         }     }); } 

thanks answer.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -