Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding Javascript leak in Chrome

I do a lot of ajax calls on my site and was using jQuery 1.4.2 until I noticed that it was leaking. It was leaking with IE, Firefox, and Chrome. After some investigation I found the IE fix for it. I tried it but it didn't fix it for any of the three browsers. I then found a posting on here where the person compared Yahoo's Javascript library to jQuery. Yahoo's didn't leak for that person. I switched to Yahoo's and it did stop the leak in IE and Firefox (I even used the Firefox leak addon). But Chrome is still leaking. Chrome builds up to around 200MB of memory and then crashes my tab. The ajax call is every second. It takes about an hour before the tab crashes. If I leave the page the memory is released. Again, IE and Firefox the problem is now gone.

What's the best way of determining where the problem is for Chrome? I looked for an add-on but haven't found one yet. I also did some searching on Google but haven't really found anything there either. I took heap snapshots but I just see big numbers next to (closure) and (code).

I liked the Firefox one (Leak Monitor), made it easy to see the problem. Anything like that for Chrome or any suggestions for finding the leak?

like image 362
GregInWI2 Avatar asked May 24 '26 21:05

GregInWI2


1 Answers

Use Chrome's built-in Heap Profiler in DevTools (press F12 in Chrome then go to Profiles tab):

enter image description here

Here you can find how to test it:

link

like image 163
denu Avatar answered May 26 '26 09:05

denu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!