Differing results depending on method of profiling

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
driggins
Posts: 1
Joined: Thu Jul 31, 2008 2:23 pm

Differing results depending on method of profiling

Post by driggins » Thu Jul 31, 2008 2:28 pm

I'm trying to verify my application no longer has a memory leak issue. When I define the project, compile my app, and then start it through mem profiler, I perform the actions in question a few times, then collect a snapshot, and either have no items or just the 16 byte collection shim, perfect. Then, I close the app, start it manually, perform the same exact operation a few times again, and attach to the process via mem profiler, do a snapshot, and I have 12 live instances and 30 unreachable instances, as well as live and unreachable array instances. Why would the 2 methods be different, and is one more reliable than the other?

As an aside, it seems the DataSource's field of a CurrencyManager is what's holding onto it, which itself appears to be held by a WeakReference, so is it possible collecting the snapshot via attach to process is not forcing a GC collection?

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

Post by Andreas Suurkuusk » Sat Aug 02, 2008 8:42 am

It is expected that there will be a difference in the numbers presented when attaching to a process. Attaching to a process is non-invasive, the profiled process is not affected in any way. Thus, when collecting a snapshot in an attached process, no GC is performed and the profiler does not wait for finalizers to run. The most accurate numbers are presented when you start the profiled application from the profiler.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests