Do you know that JetBrains provides a .NET memory profiler? You have a good excuse for not knowing this, as the profiler hasn’t seen a single update since 2010.
That is, until today.
Today we’re excited (and by this we mean really excited) to announce the availability of dotMemory 4.0 EAP, providing a brand new .NET memory profiling experience. Download early builds of dotMemory 4.0 and try ’em out!
dotMemory? Why not dotTrace Memory?
There’s a product currently available that is called dotTrace Memory 3.5, and also a performance profiler called dotTrace Performance, with the names being artifacts of splitting a formerly integrated profiler into separate memory and performance profilers several years ago.
The two profilers have since diverged. In addition, the word “dotTrace” is very loosely related to memory profiling. So we felt it was appropriate to rename the profilers. The new version of the memory profiler is going to be called dotMemory (as opposed to dotTrace Memory), while further versions of the performance profiler will be referred to as simply dotTrace (as opposed to dotTrace Performance). Until dotMemory 4.0 is released to market, both names (“dotMemory” and “dotTrace Memory”) can be used interchangeably.
Enough talking, what’s inside the profiler?
Inspired by many popular television series, we wanted dotMemory 4.0 to feel like a tool that can help with .NET memory crime scene investigations. It lets us collect data (using one or more snapshots), choose a number of suspects (that are potentially causing the issue) and follow clues until we find who’s guilty.
After deciding on being the good cop or the bad cop, we can use dotMemory to provide answers to questions like:
- Why is a specific object still in memory? What causes the memory leak?
- What is taking so much memory?
- How does garbage collection affect the performance of my application (e.g. high memory traffic)?
Let’s have a quick look at dotMemory 4.0 EAP. Do note it’s still EAP so things may change!
Starting memory profiling
After starting dotMemory, we can choose to profile a wide variety of .NET applications. There is support for standalone .NET applications, Windows Store applications, Silverlight, web applications and much more. Note that a profiling session can also be started from within Visual Studio on the project(s) that are currently open.
Exploring memory usage
After taking one or several snapshots of the application, we get to see a number of things. We can see memory usage on the different memory heaps available in .NET.
We can see the various snapshots taken during execution, and drill down into one of them or compare different snapshots. Once we open a snapshot we get a visual representation of our application’s memory usage; then we can dive into our code based on the amount of memory a given type used, based on memory fragmentation or based on dominators, objects that keep other objects in memory. We also get some common leaks shown, such as event handlers that are not being cleaned in our code.
dotMemory lets us explore further and look at objects that are being held in memory and view their dominators, instances, heap generation information and so on. With every investigative step, the left-hand navigation bar shows us exactly what we were looking at before and allows us to navigate back and forth between steps.
Give it a try!
By the way, we already have some documentation available for you, including an overview of .NET memory management: