DumpMiner – UI tool for playing with ClrMD

ClrMD is a library built by Lee Culver. This a process and crash dump introspection library. This allows you to write tools and debugger plugins which can do thing similar to SOS and PSSCOR.

I’m not going to write here about ClrMD, there are plenty of explanations on the net, but I want to talk about tool called DumpMiner I built using ClrMD.

When ClrMD came out, maybe three years ago, I started playing with it and I was very impressed. It gives you fairly easily, with managed code, to build tools which analyze dumps or live process (like WinDbg with SOS).

After I wrote a few examples, I decided to build a simple UI tool to demonstrate the operations you can do with ClrMD .

I think, beside the use you can do with this tool, is also a good start point to learn about ClrMd.

The tool is written in C # and of course with ClrMD and his UI infrastructure built with MUI (Modern UI for WPF) library.

This is not a complete tool, but a small project to work with ClrMD , however he certainly has quite a lot of examples.

Additionally, it was built in a way that you can easily add more ClrMD operations to UI.

Lets see whats inside DumpMiner.

The main classes are:

  • DebuggerSession – Manage the processes of attach\detach, load dump, symbol path, creating runtime etc.
  • ClrObject – Represents a live object from dump or process.
  • IDebuggerOperation – Represents an operation (i.e. dump heap, dump stack, etc.)
  • BaseOperationViewModel – The base view model of operation

There are more of course.

Operation may looks like this:

public async Task<IEnumerable<object>> Execute(OperationModel model, CancellationToken token, object customeParameter)
    List<string> types = model.Types?.Split(';').ToList();
    return await DebuggerSession.Instance.ExecuteOperation(() =>
        var generation = (int)customeParameter;
        var heap = DebuggerSession.Instance.Heap;
        var results = new List<object>();
        foreach (var obj in heap.EnumerateObjectAddresses().Where(ptr => (generation != -1 && generation == heap.GetGeneration(ptr)) || generation == -1))
            if (token.IsCancellationRequested)

            var type = heap.GetObjectType(obj);
            if (type == null)

            if (types?.Any(t => type.Name.ToLower().Contains(t.ToLower())) ?? true)
                results.Add(new { Address = obj, Type = type.Name, Generation = heap.GetGeneration(obj), Size = type.GetSize(obj) });
        return results;

To add a new operation, you need to write the operation itself, and a user control that you want to represent the results.

For all the rest it’s copy paste from another operation.
For a simple operation, you even not required to write anything except the operation itself.

The operations already implemented (in alpha beta order):

  • DumpClrStack
  • DumpDisassemblyMethod
  • DumpExceptions
  • DumpFinalizerQueue
  • DumpGcHandles
  • DumpHeap
  • DumpHeapSegments
  • DumpHeapStat
  • DumpLargeObjetcs
  • DumpMemoryRegions
  • DumpMethods
  • DumpModules
  • DumpObject
  • GetObjectRoot
  • GetObjectSize
  • TargetProcessInfo

There is more that I want to implement among others improvements and capabilities, but I need to find time for this…

To work with this, the process may be like that:

  1. Dump heap to search for type
  2. Dump heap stat to search for type with a lot of instances or in big size
  3. Maybe dump large object heap to search for something that should not be there
  4. Once you have a type, search for specific one. Dump object to see values, Dump size
  5. Maybe dump methods to search for a specific one and investigate is stack objects
  6. When you have a suspect object get is root to check who keep it a live

The interface (I’m not a  great UI designer 😉 )


Attach\Detach, Load dump


Dump heap – strings from generation 1


Dump object (string in address 169807932)

I’m not going to put here all the screens…

BTW, because I use MUI here, you can easily change the UI theme. Check the settings page in the application.

I’ll be happy if you try it, and if you love it that great! If something not work, you can contact me for help.

This entry was posted in .NET and tagged , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s