Profiling a windows service

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Posts: 2
Joined: Thu Nov 06, 2008 3:29 pm

Profiling a windows service

Post by howard » Thu Jun 04, 2009 8:37 am


What I've got is a native windows service that loads a mixed mode CLI\C++ dll on demand when a specific 'job' is run. So what I want to do is profile that service inbetween jobs and during jobs.

The problem is that the MemProfiler hangs waiting for notification that the profiled service has started. The services control panel applet indicates the service has started but the MemProfiler is still showing the dialog with the progress bar saying "waiting for profiled process to start".

Now I guessing that the MemProfiler is waiting for notification that the CLR has been loaded, but I might be wrong on that. I did attach WinDbg to it to see what it was waiting for but I couldn't see anything obvious. I can get you a dumpfile if you're interested.

So is this not supported? Could it be added in the future if not? It would be good if the MemProfiler gave an error when attempting this operation rather than hanging, yes I know it does say .NET windows service in the doc :) but this service will contain .NET code just not when it initially starts up.


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

Post by Andreas Suurkuusk » Thu Jun 04, 2009 7:00 pm

Yes, it is correct that the profiler is waiting for the .NET runtime to load. Currently the only way to profile your service is to wait for the .NET runtime to become loaded (with the "Waiting for.." message showing).

Future versions of the profiler will connect to the profiled process directly when it's started by the profiler (e.g. when using the "Profile Application" command). It's a bit more problematic with services, since the profiler doesn't actually start the service process, it just requests the service to start. But I think we will come up with a solution for this as well.

In the meantime (for v3.5) we will probably just change the text to "Waiting for the .NET runtime to be loaded". We cannot give an error message, because, as you mention, the .NET runtime might become loaded eventually.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests