How-To's

dotMemory Unit update: version 2.3

Following a recent ReSharper Ultimate bug fix release, we are now releasing an update to dotMemory Unit, the .NET unit testing framework to check your code for memory issues.

As a reminder, dotMemory Unit lets you extend NUnit, MSTest, xUnit.net or another .NET unit testing framework with the functionality of a memory profiler. It’s integrated with Visual Studio, works with standalone unit test runners, can be used in Continuous Integration, and is free of charge.

Highlights of dotMemory Unit 2.3

Most changes in dotMemory Unit 2.3 relate to how dotMemory Unit works with unit testing frameworks that are not supported out-of-the-box. For example, new arguments are now supported in DotMemoryUnitController‘s methods:

  • The TestStart() method now accepts an instance of the MethodBase type: TestStart(MethodBase testMethod). You can use it to remove ambiguity and clearly specify a certain method as a test. For an example of using this method, see Working with unsupported unit testing frameworks.
  • The TestFailed method now accepts a bool parameter: TestFailed(bool onMemoryAssert). Use it to indicate whether a test failed on “memory” assertion or due to a different reason.

In addition, dotMemory Unit 2.3 improves how you check memory traffic in tests. You can now place any number of AssertTraffic attributes before the test and filter traffic by any set of conditions. For example, to ensure traffic doesn’t exceed 1000 bytes and there are no objects of the Foo type, simply add two attributes before the test:

[AssertTraffic(AllocatedSizeInBytes = 1000)] 
[AssertTraffic(AllocatedObjectsCount = 0, Types = new[] { typeof(Foo) })] 
[Test]
public void TestMethod1()
{
    ... // Your code
}

For the detailed list of improvements in this dotMemory Unit update, please see dotMemory Unit 2.3 Release Notes.

Start using dotMemory Unit

You can download dotMemory Unit and start playing with it right away, or you can read the blog post that explains the basics, then take a look at some usage examples, or refer to online help for more detail.

image description