Taking a Snapshot impacts on targets behaviour

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
PGHodgson
Posts: 1
Joined: Mon Oct 11, 2010 11:38 am

Taking a Snapshot impacts on targets behaviour

Post by PGHodgson » Mon Oct 11, 2010 11:41 am

We are trying locate the source of a potential memory leak but are finidng that when ever we take a snapshot of the application in question the symptoms disappear perhaps suggesting that the profiler is enforcing or at least triggering garbage collection on the target.

Does anyone have any ideas as to why this may occur?

Regards

Paul

Andreas Suurkuusk
Posts: 1028
Joined: Wed Mar 02, 2005 7:53 pm

Re: Taking a Snapshot impacts on targets behaviour

Post by Andreas Suurkuusk » Mon Oct 11, 2010 9:24 pm

The profiler does trigger a GC when you collect a heap snapshot. It actually tries to clean up managed instances as much as possible by performing multiple GCs and allowing finalizers to run. This is performed so that the profiler can avoid presenting information about instances that are "waiting" to be GCed. Triggering GCs will not affect any memory leaks you might have in your application, rather it will hopefully make it easier to locate memory problems by eliminating unnecessary information. However, it will affect the memory utilization, since all "unused" instances will be GCed at the time of the heap snapshot. If you are investigating memory utilization problems, you can enable the Heap utilization tracker. When the heap utilization tracker is enabled, you can use the "Collect gen #0 heap snapshot" command to collect heap snapshots using only a single gen #0 GC. This will minimize the effect the heap snapshot has on memory utilization. You will also get additional information, such as information about unreachable instances on the GC heap.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests