Profiler API and "Attach to process" behaviour

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
oakinger
Posts: 1
Joined: Sat Apr 14, 2007 9:46 pm

Profiler API and "Attach to process" behaviour

Post by oakinger » Sat Apr 14, 2007 9:52 pm

Hi,

when using the MemProfiler.FullSnapShot() method, I don't see anything in the MP3 UI. I profile the process by attaching using "Attach to process" method.

Is this a bug or am I doing something wrong? I expect to see the snapshot in the UI as soon as the call to MemProfiler.FullSnapShot() finishes.

I'm using MP3 in trial mode for evaluation.

-Erich

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

Post by Andreas Suurkuusk » Sun Apr 15, 2007 6:09 pm

When you attach to a process, the process itself is not aware of the profiler, and the .NET Memory Profiler API methods are not active (i.e. MemProfiler.IsProfiling will return false). To use the MemProfiler and MemAssertion methods, you must start the profiled process from the profiler (e.g. by using Profile Application, Profile ASP.NET or Profile Service). The documentation is apparantly lacking since it does not mention this. We will add information about this in a future release.

It is possible for us to add support for the memory profiler API in an attached process, but it will involve quite a lot of work and the assertion methods will not work very well (e.g. they might become very slow). When doing normal profiling, the assertion methods are not much more expensive than a standard GC, but when attaching they will require a lot more processing.

We will take your comment into consideration, and maybe we will allow some or all of the API methods to be used even when attaching.
Best regards,

Andreas Suurkuusk
SciTech Software AB

KevinE
Posts: 1
Joined: Wed Oct 07, 2009 10:00 pm

Post by KevinE » Wed Oct 07, 2009 10:07 pm

I would appreciate this feature. Our app consists of 1k DLLs and takes a very long time to start up when running under the profiler. Most of the time we do not care about the allocations that occur in all of this initialization and it is much faster to start the application, attach and then take a base-line snapshot.
Andreas Suurkuusk wrote: It is possible for us to add support for the memory profiler API in an attached process, but it will involve quite a lot of work and the assertion methods will not work very well (e.g. they might become very slow). When doing normal profiling, the assertion methods are not much more expensive than a standard GC, but when attaching they will require a lot more processing.

We will take your comment into consideration, and maybe we will allow some or all of the API methods to be used even when attaching.

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

Post by Andreas Suurkuusk » Thu Oct 08, 2009 6:47 pm

.NET Framework 4.0 will include better support for attaching a profiler to a running process. The next version of .NET Memory Profiler will take advantage of the improved "attach-to" capability, which will make it possible to perform memory assertions and trigger heap snapshots from within an attached process.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 28 guests