Reset memory snapshots Garbage collection in dotMemory

I am using dotMemory for an asp.net mvc application running on IIS.

And I suspect that "getting a snapshot" causes the launch of GC gen2. What for? Here is the image:

Create gc snapshots Question: is he normal? Why can't I get a snapshot showing me all this not included in the GC stuff? Every time I get a snapshot: memory usage drops.

+4
source share
2 answers

Yes, this is normal behavior because it does a full garbage collection before taking a snapshot. If you see that memory usage drops when you get a snapshot, this is a good sign.

The garbage collector clears the memory only when there is a memory voltage. If you want to check for memory leaks, you need to complete a complete garbage collection and get a snapshot. If something remains, it is a memory leak.

Typically, you should get a clean base snapshot, and then another clean snapshot after completing the function you want to test, and then compare both snapshots.

+6
source

Microsoft's profiling API works this way, dotMemory initiates garbage collection and collects the object graph during the GC.

+1
source

All Articles