See loaded assemblies and .Net performance counters with Process Explorer

The latest version of the Windows SysInternals ProcessExplorer now shows the list of loaded assemblies and appdomains as well as a view of the .Net performance counters.


Exploring loaded assemblies of any .Net process


For this to work, you will need Administrator rights, so right-click on processxp.exe and select the Run as administrator entry.

Then select any .Net process, double click to view its details view and select the .Net Assemblies tab.
You will then be treated to the process structure, which is defined this way:

{CLR Version} > {AppDomain} > {Assembly}

For each item you'll see the flags that are set. In this case, I'm running Visual Studio 2010 on a multicore machine so the Concurrent Garbage Collector is enabled. Seems like this app is well-behaved and doesn't load any 2.0 assemblies, and also load the whole 2.0 .Net CLR side-by-side with 4.0 .Net CLR.

You can also see for each assembly where the assembly was loaded from, which can shed light on all your GAC issues.

I'm also using Resharper 5 beta for Visual Studio 2010 and you can see there's a lot of managed assemblies in there. That would explain the huge memory footprint. Can we have One  Assembly To Rule Them All please? 

If you want to create your own appdomain to test






Here's some quick'n dirty code so you can see what a basic .Net app looks like, and peek at what Visual Studio 2010 VSHost does to your appdomains.




using System;
using System.Threading;

namespace AppDomainDemo
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            for (int i = 0; i < 3; i++)
            {
                AppDomain domain = AppDomain.CreateDomain("Test Domain" + i);
                domain.DoCallBack(() => new Thread(new Worker().DoWork).Start());
            }
            Console.WriteLine("running, press any key to stop");
            Console.ReadKey();
        }
    }

    class Worker
    {
        public void DoWork()
        {
            while (true)
            {
                for (int i = 0; i < 500; i++) // let's simulate some load
                    new string('x', i).GetHashCode();
                Console.Out.WriteLine("Working in " + AppDomain.CurrentDomain.FriendlyName);
                Thread.Sleep(500);
            }
        }
    }
}


Happy peeking ;)



No comments:

Post a Comment

Please leave your comments in English or French and I will be pleased to answer them if you have any questions.

Spammers will be walked down the plank matey. Arrr!