Method Assert
Assert(MemSnapshot, AssertionsDefinition, AssertionsThread)
Asserts that the memory usage since the comparisonSnapshot
meets the memory usage
defined by the supplied AssertionsDefinition.
Declaration
public static bool Assert(MemSnapshot comparisonSnapshot, AssertionsDefinition assertionsDefinition, AssertionsThread assertionsThread)
Parameters
Type | Name | Description |
---|---|---|
MemSnapshot | comparisonSnapshot | Identifies the snapshot to use as the comparison snapshot. Instances that did not exist at the time of the comparison snapshot, are considered to be new instances. |
AssertionsDefinition | assertionsDefinition | Defines the expected memory usage. For more information, see AssertionsDefinition. |
AssertionsThread | assertionsThread | Indicates whether instances of all threads should be checked,
or only instances created by the calling thread. If this parameter is noteThis parameter does not affect allocation assertions (AssertionsDefinition.MaxAllocations and AssertionsDefinition.MaxAllocatedBytes). Allocations for all threads are always considered for allocation assertions. |
Returns
Type | Description |
---|---|
System.Boolean | If the current process is being profiled,
If the current process is not being profiled, no assertion is performed and |
Assert(MemSnapshot, AssertionsDefinition)
Asserts that the memory usage since the comparisonSnapshot
meets the memory usage
defined by the supplied AssertionsDefinition. Only instances
created by the calling thread will be checked by this assertion.
note
Allocations for all threads are always considered for the allocation assertions (AssertionsDefinition.MaxAllocations and AssertionsDefinition.MaxAllocatedBytes).
Declaration
public static bool Assert(MemSnapshot comparisonSnapshot, AssertionsDefinition assertionsDefinition)
Parameters
Type | Name | Description |
---|---|---|
MemSnapshot | comparisonSnapshot | Identifies the snapshot to use as the comparison snapshot. Instances that did not exist at the time of the comparison snapshot, are considered to be new instances. |
AssertionsDefinition | assertionsDefinition | Defines the expected memory usage. For more information, see AssertionsDefinition. |
Returns
Type | Description |
---|---|
System.Boolean | If the current process is being profiled,
If the current process is not being profiled, no assertion is performed and |
Assert(AssertionsDefinition, AssertionsThread)
Asserts that the memory usage since the last call to MemProfiler.FastSnapshot or MemProfiler.FullSnapshot meets the memory usage defined by the supplied AssertionsDefinition.
Declaration
public static bool Assert(AssertionsDefinition assertionsDefinition, AssertionsThread assertionsThread)
Parameters
Type | Name | Description |
---|---|---|
AssertionsDefinition | assertionsDefinition | Defines the expected memory usage. For more information, see AssertionsDefinition. |
AssertionsThread | assertionsThread | Indicates whether instances of all threads should be checked,
or only instances created by the calling thread. If this parameter is |
Returns
Type | Description |
---|---|
System.Boolean | If the current process is being profiled,
If the current process is not being profiled, no assertion is performed and |
Assert(AssertionsDefinition)
Asserts that the memory usage since the last call to MemProfiler.FastSnapshot or MemProfiler.FullSnapshot meets the memory usage defined by the supplied AssertionsDefinition. Only instances created by the calling thread will be checked by this assertion.
Declaration
public static bool Assert(AssertionsDefinition assertionsDefinition)
Parameters
Type | Name | Description |
---|---|---|
AssertionsDefinition | assertionsDefinition | Defines the expected memory usage. For more information, see AssertionsDefinition. |
Returns
Type | Description |
---|---|
System.Boolean | If the current process is being profiled,
If the current process is not being profiled, no assertion is performed and |