dotMemory Unit supports .NET Core 2.0, and more updates

Though dotMemory Unit is not part of the ReSharper Ultimate bundle, in this release dotMemory Unit 3.0 is provided with ReSharper 2017.3. What’s in this release?

.NET Core 2.0 support

You’ve asked us to add support for .NET Core for quite a while. Now, with the more mature and stable .NET Core 2.0 release, this request became even more urgent. So, yes, dotMemory Unit 3.0 provides support for .NET Core 2.0 unit tests (currently, only on Windows).

Getting groups of objects

Due to a separate release cycle, dotMemory Unit 2.4 was released in the interim between ReSharper Ultimate 2017.2 and 2017.3, so, probably most of you simply missed it (especially, taking into account that we didn’t make any special announcements). Let’s fill the gaps in this post.

The most significant feature in dotMemory Unit 2.4 is the GroupByType method that allows you to quickly group objects by type inside of an object set. The method returns a collection of TypeMemoryInfo instances, each representing a particular group and allowing you to get data on ObjectsCount, SizeInBytes, Type, and TypeFullyQualifiedName.

dotMemory.Check(memory =>
  var group = memory.GroupByType();
  var largeTypes = group.Where(typeMemoryInfo =>
    typeMemoryInfo.SizeInBytes > 1000000).ToList();

  // do sth. with largeTypes

The Traffic class also gets the similar GroupByType method. The only difference is that groups are presented via the TypeTrafficInfo type. Each group (an instance of TypeTrafficInfo) allows you to get info on allocated and collected objects (AllocatedMemoryInfo and CollectedMemoryInfo) and of course data on objects type (Type and TypeFullyQualifiedName):

var checkPoint1 = dotMemory.Check();

// do sth.

dotMemory.Check(memory =>
  var traffic = memory.GetTrafficFrom(checkPoint1);
  var group = traffic.GroupByType();
  var heavyTrafficTypes =
    group.Where(typeMemoryInfo => typeMemoryInfo.AllocatedMemoryInfo.SizeInBytes > 1000000).ToList();

  // do sth. with heavyTrafficTypes

And finally, one last important note: Snapshots collected by dotMemory Unit 3.0 can be opened only in dotMemory 2017.3.

As usual, we suggest you check out all the latest features of dotMemory Unit for yourself. The easiest way to do this is to install the corresponding NuGet package into your project:
Install-Package JetBrains.DotMemoryUnit

image description