Compare Snapshots
The SnapshotDifference
type allows you to compare two memory checkpoints (snapshots) created by the dotMemory.Check method and get data about how many objects were created between snapshots and how many objects were collected. This may help you, for example, to determine ineffective memory usage or a memory leak. The object of the SnapshotDifference
type is a result of the GetDifference
method* of the Memory type.
Example
For example, the following code asserts that foo.Bar()
creates 10 or less strings:
SnapshotDifference class
Represents difference between two memory snapshots.
SnapshotDifference methods
Name | Description |
---|---|
| Gets a set of new objects - the ones that were created and not collected in the time interval between getting memory checkpoints. Returns an instance of the ObjectSet type. If |
| Gets a set of "dead" objects - the ones that were created before getting the base memory checkpoint and collected in the time interval before getting the second checkpoint. Returns an instance of the ObjectSet type. If |
| Gets a set of survived objects - the ones that were created before getting the base memory checkpoint and not collected in the time interval before getting the second snapshot. The Returns an instance of the ObjectSet type. If |
Origin enum
Represents memory checkpoints (snapshots) taken for comparison.
Value | Description |
---|---|
| Older (base) memory checkpoint. |
| Newer memory checkpoint. |