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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -