.NET Memory Profiler API

The .NET Memory Profiler API can be used to control the profiler within the profiled process, retrieve the memory usage (allocations and instances), and to detect potential memory leaks using assertions. This API is very well suited for doing automated testing of memory usage errors, e.g., by using a unit testing framework such as NUnit, XUnit, or VSTest.

The API can be accessed by adding the SciTech.MemProfilerApi NuGet package. This package includes the class library SciTech.MemProfilerApi.dll, which supports .NET Framework 2.0 or later, and .NET Standard 1.1 or later. The class library is also available under the Redist folder in the .NET Memory Profiler installation folder (default location: C:\Program files\SciTech\NetMemProfiler5\Redist).

This class library contains the two main classes of the API:

      SciTech.NetMemProfiler.MemProfiler

      SciTech.NetMemProfiler.MemAssertion

The MemProfiler class contains static methods that can be used to:

      Detect whether the current process is running under the profiler (MemProfiler.IsProfiling).

      Collect fast snapshots that can be used as a reference when retrieving memory usage and doing memory assertions (MemProfiler.FastSnapshot).

      Collect full snapshots that will be saved by the profiler (MemProfiler.FullSnapshot).

      Retrieve memory usage information from within the profiled process (MemProfiler.GetMemoryUsage).

      Add comments that will be shown in the real-time graph of the profiler (MemProfiler.AddComment).

The MemAssertion class contains static methods for asserting that certain class instances do not exist (NoInstances, NoNewInstances, and NoNewInstancesExcept). It also contains methods for grouping several assertions into one assertion session (BeginAssertions and EndAssertions).

For reference information about the .NET Memory Profiler API methods, see the .NET Memory Profiler API Reference documentation.

.NET Memory Profiler User Manual

© Copyright 2002-2019. SciTech Software AB.

For information about .NET Memory Profiler, see the product site at http://memprofiler.com

.NET Memory Profiler is developed by SciTech Software AB