Monitor .NET Memory Usage with Unit Tests

dotMemory Unit is a unit testing framework which allows you to write tests that check your code for all kinds of memory issues. You can now extend NUnit, MSTest or another .NET unit testing framework with the functionality of a memory profiler.

dotMemory Unit fits any workflow: it can integrate with JetBrains Rider and Visual Studio, works with standalone unit test runners, and is Continuous Integration–ready. Last but not least, dotMemory Unit is free.

Get NuGet package

Free NuGet package

Download zip

Free stand-alone runner

Effective memory usage in .NET applications with dotMemory Unit

Check for objects

Check for objects

Checking for objects of a certain type is the main way to locate memory leaks in your code. With dotMemory Unit, you can specify a set of objects by almost any condition, calculate their number and size, and use this information in your assertions.

Check memory traffic

Check memory traffic

When you need to simply evaluate the amount of memory allocated in a test, you can use the AssertTraffic attribute. This flexible attribute allows you to filter traffic data by object type, interface, or namespace.

Compare snapshots

Compare snapshots

Like in the dotMemory profiler, you can use checkpoints not only for traffic amount assertions, but also for many kinds of snapshot comparisons.

Continue analysis in dotMemory

Continue analysis in dotMemory

Some memory issues will still require further manual investigation in dotMemory. Just set the rules when you want this done, and a workspace for further analysis in dotMemory will be created automatically.

Try dotMemory Unit

  • Can be installed as NuGet package in your test project and used in JetBrains Rider or Visual Studio.
  • Can be used with stand-alone unit test runners.
  • Ready to be part of your Continuous Integration builds.
  • Works with most .NET unit testing frameworks, including MSTest and NUnit.
Get NuGet package

Free NuGet package

Download zip

Free stand-alone runner