Before couple of weeks, we wanted to check whether our application has memory leaks issue or not? And while doing that we found few articles, understood something, and learnt something which I would like to share with you.
Best links to read:
Basically, to detect Memory leak you should check following things:
You should check if Private Bytes/Bytes in all heaps/Virtual bytes increase at the same rate. If you don’t see growing of private bytes, so it means no any memory leak is happening!
Expert comments from Ekaterina — Genius person on this earth who helped us to understand this issue (God bless Ekaterina and Tess!):
This counter displays the number of times the generation 0 objects (youngest; most recently allocated) are garbage collected (Gen 0 GC) since the start of the application.So when this number becomes higher over the time, it is OK. It just should grow at steady pace.
if you create a simple program, that will create in cycle a lot of large objects and put them to some archive (this will be not really a memory leak however you’ll get an OOM). In this case private bytes and bytes in all heaps will grow at the
same rate, and this can be treated as excessive memory consuming in managed code.
Also I noticed that when you have this memory problem, number of GC collection is also jumping and growing high very quickly – because new large portions of memory should be allocated fast, so I also pay attention to GC behavior.
Happy Coding! 🙂