Checking Memory Traffic
Checking memory traffic
When you need just to evaluate the amount of memory allocated in a test, you can use the AssertTraffic attribute.
The attribute is quite flexible and allows you to filter traffic data by objects' type, interface, or namespace.
Note that you can add any number of
AssertTraffic attributes in case you want to filter memory traffic by a number of conditions.
Filtering memory traffic by complex conditions
In more complex scenarios (e.g. when you need to check traffic on a specific time interval), you should use the Traffic type.
To mark time intervals where memory traffic can be analyzed, you should use checkpoints created by dotMemory.Check (as you probably guessed, this method simply takes memory snapshot).
The checkpoint that defines the starting point of the interval is passed to the
For example, this line asserts that the total size of objects implementing the
IFoointerface created on the interval between
memoryCheckPoint2is less than 1000 bytes.
You can use any checkpoint created earlier as a base for analysis. Thus, this line gets traffic data between the current
dotMemory Unit also provides alternative syntax for traffic queries. You can use the
| logic operators to combine a number of queries. For example: