Search Results for

    Show / Hide Table of Contents

    Method FullSnapshot

    FullSnapshot(Boolean)

    Collects a full snapshot and allows .NET Memory Profiler to assign a default name to the snapshot.

    Declaration
    public static MemSnapshot FullSnapshot(bool storeAsBaseSnapshot = false)
    Parameters
    Type Name Description
    System.Boolean storeAsBaseSnapshot

    Indicates whether the snapshot should be stored as a base snapshot for subsequent allocations. By default this parameter is false.

    Returns
    Type Description
    MemSnapshot

    If profiling is active, a MemSnapshot instance representing the state of the garbage collected heap directly after the snapshot. Otherwise Empty will be returned.

    Remarks
    note

    A snapshot consumes a significant amount of memory. If storeAsBaseSnapshot is true the snapshot cannot be garbage collected until a new snapshot is collected. Instead, it is recommended that the base snapshot is explicitly specified when calling the assertion methods or retrieving memory usage.

    FullSnapshot(String, Boolean)

    Collects a full snapshot and provides the name of the snapshot.

    Declaration
    public static MemSnapshot FullSnapshot(string snapshotName, bool storeAsBaseSnapshot = false)
    Parameters
    Type Name Description
    System.String snapshotName

    Defines the name of the snapshot. This name will be used when .NET Memory Profiler saves the snapshot.

    System.Boolean storeAsBaseSnapshot

    Indicates whether the snapshot should be stored as a base snapshot for subsequent allocations. By default this parameter is false.

    Returns
    Type Description
    MemSnapshot

    If profiling is active, a MemSnapshot instance representing the current state of the garbage collected heap. Otherwise Empty will be returned.

    Examples
    void ReportHeapStatus()
    {
    	// Collect a full heap snapshot that can be analysed using .NET Memory Profiler.
    	MemProfiler.FullSnapshot( "My automatically reported snapshot" ); 
    }
    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