Javascript leak search in Chrome

I make a lot of ajax calls on my site and used jQuery 1.4.2 until I noticed that it is leaking. It flowed with IE, Firefox and Chrome. After some investigation, I found an IE fix for it. I tried but did not fix it for any of the three browsers. Then I found the wiring here, where a person was comparing Yahoo's Javascript library with jQuery. Yahoo did not leak for this person. I switched to Yahoo and this stopped the leak in IE and Firefox (I even used the Firefox leak addon). But Chrome is still leaking. Chrome creates up to 200 MB of memory and then resets my tab. Ajax call is made every second. It will take about an hour before the tab breaks down. If I leave the page, the memory will be released. Again, IE and Firefox the problem has now disappeared.

What is the best way to determine where the problem is for Chrome? I was looking for a supplement, but have not found it yet. I also did some searches on Google, but actually did not find anything. I took pictures of the heap, but I just see large numbers next to (closing) and (code).

I liked Firefox (Leak Monitor), which simplified the problem. Anything like this for Chrome or any suggestions for leak detection?

+3
source share
2 answers

The structure does not leak, this is your code. Let me guess how your code looks.

$.get('//url/',function(){
   //lets do fun stuff!
   function(){
     //more fun expensive stuff for the browser to do
   }
};

//A more efficient way (doesn't create closures)
function expensivefn(){
  //Do expensive stuff here
}
$.get('//url',expensivefn);

, . , , , , . , , , . ,

//Bad!
setInterval(function(){
  //Expensive stuff
}, 1000)

//Good
function expensivestuff(){
  //Expensive stuff
}
setInterval(expensivestuff,1000);
+4

Heap DevTools ( F12 Chrome, "" ):

enter image description here

, :

+6

Source: https://habr.com/ru/post/1769368/