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.
For example, the following code asserts that
foo.Bar() creates 10 or less strings:
Represents difference between two memory snapshots.
Gets a set of new objects - the ones that were created and not collected in the time interval between getting memory checkpoints.
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.
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
Represents memory checkpoints (snapshots) taken for comparison.
Older (base) memory checkpoint.
Newer memory checkpoint.