Why slowing down functionality on the page when you use setInterval?

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();
June 10th 19 at 15:26
1 answer
June 10th 19 at 15:28
Page slow because of the timer. Every second needs to take data from a file. Function GetCHANGE only reads data from a json file, nothing more. These data are added every second to memory.
The memory is cleared only by reloading page. Without the timer everything works fine.

P. S. the name of the function will necessarily change. Thank you
Specially for you made a snapshot of the memory, though, and so know that it is not in the 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

Find more questions by tags ProgrammingJavaScript