dotMemory Unit 2.3 Help

Turning On Collecting of Allocation Data

By default, memory allocation data (memory traffic and creation stack trace data) are not collected by the profiler. This is done due to performance considerations as collecting of these data implies significant profiling overhead. Such a behavior suits for simple tests when all your test does is checking for presence of certain objects in the heap. If your test requires allocation data, for example, it checks the amount of memory traffic, then you should manually turn on the collecting of memory allocation data.

This can be done by using the DotMemoryUnit attribute:

[DotMemoryUnit(CollectAllocations=true)] [Test] public void TestMethod1() { ... // Some user code }

The AssertTraffic attribute also automatically turns on the collecting of the allocation data:

[AssertTraffic(AllocatedMemoryAmount = 1024)] [Test] public void TestMethod1() { ... // Some user code }
Last modified: 23 May 2016