Download CLR Profiler for .NET 2.0 Framework.
The CLR profiler is great; it’s sweet to be able to see where memory is allocated and how well objects are disposed of (and whether or not I missed something that GC just isn’t catching).
The form is pretty easy to use, but there’s a bit of a trick for VS 2008 web application profiling when using the built-in Web Development Server.
NOTE: This isn’t anything like the ANTS Profiler (which I wish I had a license for, but don’t). ANTS will tell you where code slowdowns are and more, this simply returns back histographs of object usage, memory, and the stack/heap. Still very useful none the less.
Here’s how to get started:
1. Download the CLR profiler (see the link at the beginning of this article or click here).
2. Extract the profiler into a directory (it defaults to C:\CLRProfiler); it will extract two directory structures (binaries, source) and a readme document.
3. To start using the application immediately, browse into the Binaries directory and execute the CLRProfiler.
Use the x86 version. I haven’t been able to get the x64 version to work correctly (even though I’m on a x64 machine) when profiling .NET web applications ala the built-in web development server.
4. Under File > Set Parameters, modify the “Command Line” to reflect the parameters required to start the built-in web development server. After the parameters have been set, click OK.
Usually, you have a Port parameter and a Path parameter. Here’s an example:
/port:1234 /path:“J:\Projects\Work\Current\ERC\web\”
5. Click ‘Start Application’. A browse window will open. Visual Studio 2008’s web development server is located in the Common Files directory.
%CommonProgramFiles%
\Microsoft Shared\DevServer\9.0
or
%CommonProgramFiles(x86)
\Microsoft Shared\DevServer\9.0
6. After selecting the WebDev.WebServer.Exe application file, your server will kick off with the parameters you set.
Now you’re ready to open up a web browser, begin browsing around, and evaluate your application. When finished, click the ‘Kill Application’ button on the Profiler or simply close the WebServer application.