Page 1 of 1

Taking a Snapshot impacts on targets behaviour

Posted: Mon Oct 11, 2010 11:41 am
by PGHodgson
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

Re: Taking a Snapshot impacts on targets behaviour

Posted: Mon Oct 11, 2010 9:24 pm
by Andreas Suurkuusk
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.