In this article I will take a very simplistic approach in understanding memory leaks and I will also attempt to diagnose them.
In todays world of ...
For further actions, you may consider blocking this person and/or reporting abuse
This is gold and exactly what I needed! I'm writing a thing on analyzing performance issues and I almost forgot about memory leaks. Thank you :).
Thanks for your kind words.
Nice post! Chrome dev tools are awesome
I'd say it reverses the order of the elements.
To me, it is easy to see it is an infinite loop :'D
With j++, it would run 0 + 1 +...+ n-1 times. Thus, n*(n-1)/2 times.
This article is a simple tutorial to memory leak & its analysis in a web browser =) I used Firefox 60 instead of Chrome without any hassle.
Thank you !
But after you invoke the function, the GC needs to collect it, no?
var hello = sayHi();
hello('Gandhi'); <=== I'm done
If we were in the global scope you are right, but if I'm within a scoped module, it will released the memory as soon as the second line execute.
As long as the โhelloโ variable is in reference ( global or modular ), it will keep leaking memory.
You can run the hello function yourself and see memory usage increasing.
Thank you for very informative article!
Are you aware of any differences between JS engines when it comes to garbage collection?
I am not sure, but yes the GC varies wrt engines. I have read this great article on V8 medium.com/@_lrlna/garbage-collect...
Hope it helps you.
That's actually quite nice article, thanks!
Your example is really awesome. When I ran the example I found that old references were in (array) section. I sorted by Size Delta. Maybe due to different version of chrome.