JetBrains Rider 2024.1 Help

Attach to and profile .NET processes

dotMemory lets you profile any .NET | .NET Core process that is already running in the system. The profiling workflow looks as follows:

  1. Decide which profiling configuration you will use.

  2. Run the profiling session and get the data.

  3. Analyze the collected data.

Run a profiling session

  1. In the run widget menu, choose Profile running process. This will open a list of running processes.

    Start profiling session
  2. Select the process you want to profile (note that this must be a managed .NET process), and in the context menu, choose a suitable profiling configuration. Note that it is not possible to collect full allocation data when attaching to a process.

    Process list

    Once the profiling is started, Rider will open an Analysis editor document with the profiling controller inside.

  3. Reproduce the issue you're looking for or, if you just want to evaluate the memory usage, go through the desired usage scenarios in your application.

  4. Use the Get snapshot Get Snapshot button to take one or more memory snapshots (for example, before and after a particular activity in your application). If you want to analyze only memory allocation, you can take no snapshots at all.

    You can also use the Get snapshot Get Snapshot by Condition button to set up getting snapshots on a specific condition.

    Analysis document
  5. After you collect the data, you can finish the profiling session. Normally, you do it either by closing the profiled application or by detaching the profiler via the Detach profiler Detach button (Kill processes Kill forcibly terminates the profiled application and the session, so, use it only in emergency cases).

  6. Analyze the collected data.

    dotMemory saves the data collected during a profiling session to a workspace. This includes memory allocation data and memory snapshots.

About profiling configurations

  • Before starting a profiling session, you must decide which profiling configuration you will use. Typically, you decide between

  • The profiling configuration specifies profiling session settings like which allocation data must be collected, whether child processes must be profiled, and so on.

  • The profiling target is a running .NET process you're going to attach to.

Create a custom profiling configuration

  1. From the menu bar, choose Run | Switch Profiling Configuration | Edit Configurations.

  2. In the opened Profiling Configurations window, click to add a new profiling configuration.

  3. In the list, select a data collection mode (always Memory (Sampled allocations) if you're going to profile an attached process).

  4. Specify configuration Name and other profiling options:

    Control profiling manually

    Enables you to control profiling manually via the profiler controls.

    Control profiling via API

    Enables you to control profiling directly from the code of the profiled application. Learn more about using the API in the dotMemory documentation.

    Profile child processes

    If selected, dotMemory will profile not only the main app process but the processes it runs as well.

Last modified: 10 April 2024