Compare Snapshots
As well as in the dotMemory profiler, you can use checkpoints not only for traffic amount assertions but for all kinds of snapshot comparisons. E.g., in the example below we assert that no objects from the MyApp
namespace survived garbage collection on the interval between memoryCheckPoint1
and the second dotMemory.Check
call.
var memoryCheckPoint1 = dotMemory.Check();
foo.Bar();
dotMemory.Check(memory =>
{
Assert.That(memory.GetDifference(memoryCheckPoint1)
.GetSurvivedObjects(where => where.Namespace.Like("MyApp")).ObjectsCount, Is.EqualTo(0));
});
Last modified: 10 May 2022