Search Results for

    Show / Hide Table of Contents

    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 AssertionsThread.All, then instances of all threads will be checked. If it is AssertionsThread.Caller, then only instances created by the calling thread will be checked.

    note

    This 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, true will be returned if the assertion succeeds, otherwise false will be returned.

    If the current process is not being profiled, no assertion is performed and true will always be returned.

    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, true will be returned if the assertion succeeds, otherwise false will be returned.

    If the current process is not being profiled, no assertion is performed and true will always be returned.

    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 AssertionsThread.All, then instances of all threads will be checked. If it is AssertionsThread.Caller, then only instances created by the calling thread will be checked.

    Returns
    Type Description
    System.Boolean

    If the current process is being profiled, true will be returned if the assertion succeeds, otherwise false will be returned.

    If the current process is not being profiled, no assertion is performed and true will always be returned.

    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, true will be returned if the assertion succeeds, otherwise false will be returned.

    If the current process is not being profiled, no assertion is performed and true will always be returned.

    In This Article
    Back to top

    © Copyright 2002-2020. SciTech Software AB.
    For information about .NET Memory Profiler, see the product site at https://memprofiler.com