2

I'd like to use a memory profiler to determine if I have memory links in a fairly complicated windows service written in C#, that has a large number of running threads. If I loop the code in the service continuously repeating the same operations, its memory footprint grows continuously.

I was disappointed to find out that the Performance Analysis tools built into Visual Studio 2010 would not work with a Windows Service (or at least it didn't appear to be possible to use it with a Windows Service).

Does anyone know a way of getting the VS 2010 tools to work with a Windows Service?

Paul
  • 43
  • 5

1 Answers1

3

The only workaround I know of is refactoring your service to be able to run as application as well as windows service based on a command line switch - see here for a detailed solution to this. In doing that you can now apply performance analysis when running as regular application and you do not have to modify your code base to run as Windows service once you are done.

Community
  • 1
  • 1
BrokenGlass
  • 158,293
  • 28
  • 286
  • 335
  • Thanks - your solution makes sense - although I ended up using ANTS memory profiler instead - which was a much simpler solution and definitely worth purchasing. Pretty frustrating that Microsoft's solution won't work for a service without having to refactor the code :-( – Paul May 09 '11 at 12:33