Use dotMemory Command-Line Profiler

Last modified: 08 March 2021

There are multiple scenarios of how you can use the dotMemory command-line tool:

  • Profiling an application on a remote server.
    For example, this may be the case when it is not possible to install the standalone dotMemory to a server.

  • Automating the process of gathering memory snapshots.
    For example, if you want to make profiling a part of your continuous integration builds: this can be a build step that performs profiling of your integration tests.

  • Speeding up profiling routines.
    For example, when you regularly profile the same application and do not want to start the dotMemory user interface each time.

The dotMemory command-line tool can be used to profile any .NET or .NET Core application (including an already running one) and take memory snapshots.

Note that the tool is distributed free of charge as a .zip archive or NuGet package (Windows, Linux, macOS) and does not require dotMemory to be installed. You can freely upload it to any computer to take memory snapshots of problematic applications.

Main profiler commands:

  • get-snapshot- instantly get snapshot of a running app.

  • attach- attach the profiler to a running app and get snapshots by condition, using the API, or by sending commands to stdin.

  • start- start an app and get snapshots by condition, using the API, or by sending commands to stdin.

  • start-net-core- start a .NET Core app and get snapshots by condition, using the API, or by sending commands to stdin.

  • start-iis- (Windows only) start IIS and get snapshots by condition, using the API, or by sending commands to stdin.

  • start-iis-express- (Windows only) start IIS Express-hosted web application under profiling.

  • start-windows-service- (Windows only) (re)start managed Windows service under profiling and get memory snapshot by condition or using the API.

  • start-wcf-service- (Windows only) (re)start WCF host with specified WCF Service Library under profiling and get memory snapshot by condition or using the API.

  • start-winrt- (Windows only) start WinRT application under profiling and get memory snapshot by condition or using the API.

  • profile-new-processes- (Windows only) profile any managed application that is launched after executing this command.

  • list-iis-express- (Windows only) show the list of available IIS Express installations.

  • list-wcf-host- (Windows only) show the list of available WCF hosts.

  • list-winrt- (Windows only) show the list of available WinRT applications.

For the detailed information on a particular command, run: dotMemory.exe help <command> (Windows), ./dotMemory.sh help <command> (Linux, macOS).

This section covers only most basic tool usage scenarios: