The json file should be read each second. (file size is about 1KB)
Getting data from json file implemented using AJAX jQuery (function GetCHANGE())
In a few minutes after starting the page all functionality on the page starts to slow down and more and more. How can I solve this problem?
Code:
function timer(){
setInterval(function() {
var autoPlay = setInterval( GetCHANGE(), 1000 );
if (autoPlay!=='undefined'){
clearInterval(autoPlay);
}
}, 1000);
}
timer();
At the start in JSFiddle: 14.6 MB
After 10 minutes: 14.3 MB
The problem is in your function. The timer is nothing to do with.
But without a timer you have no brakes, because your function does not contaminate memory every second.
Try it is its function to output to console.log or run () =>{} and see for yourself. - Lenny.Botsfo commented on June 10th 19 at 15:31