JetBrains Rider 2023.3 Help

Profile applications

Regardless of what application type you are going to profile, the workflow always looks the same:

  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 window header, select the run configuration you want to profile.

  2. In the run widget menu, choose Profile with, then choose a profiling configuration:

    Profiling configurations in Rider

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

  3. Reproduce the issue you are 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 always an executable* which is specified in the currently selected run configuration.

  • Currently, you are able to profile the following run configuration types:

    If you select a run configuration of some other type, this will disable the profiling controls on the toolbar.

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: either Memory (Sampled allocations), or Memory (Full allocations). Learn more about the modes.

  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.

Profiling controls

Force GC

Forces full garbage collection in the application.

Detach

Detaches the profiler from the application but keeps the application running.

The Detach operation is available only in case you attach the profiler to an already running app.

Kill

Kills the currently selected process of the application.

Use Kill Process with caution: the unconditional termination of a process may lead to loss of data your app works with. Typically, you should close profiled apps in a normal way.

Kill All

Kills all processes of the application.

The list of processes and the Kill All Processes button are shown only in case you profile the app running multiple processes.

Full allocation data

Off (default): the profiler collects data on calls that allocate memory and approximate size of allocated objects. This mode doesn't affect application performance. Time intervals with sampled data are marked with a dotted green line

Sampled data

on the timeline graph.

On: the profiler collects data on calls that allocate memory and detailed data on size and count of allocated objects. This mode significantly slows down the profiled application. Time intervals with full data are marked with a green line

Full data

on the timeline graph.

Get Snapshot

Gets a memory snapshot for the process selected in the list of processes. The snapshot is added to the collected snapshot area.

Getting a snapshot does not interrupt the profiling process, allowing you to get another snapshot (which, for example, can be compared with the first one later). After you finish capturing snapshots, you can proceed to analyzing profiling results.

Get Snapshot by Condition Get Snapshot by Condition

Opens the Get Snapshot by Condition window. Using this window, you can configure dotMemory to automatically get snapshots when a particular condition is triggered.

Get snapshots by condition

Sometimes you may be interested in taking snapshots only when a certain condition takes place. The most popular case is taking a snapshot when the memory consumption of your application is dramatically increased. As doing this manually (using the Get Snapshot button) is quite tricky, dotMemory allows you to automate this process. All you need is to set a particular condition and snapshots will be collected automatically after the condition takes place. Currently, the following conditions are supported:

  • Memory consumption increase in MB.

  • Memory consumption increase in %.

  • Period of time in minutes (periodical taking of snapshots).

To enable collecting snapshots by condition

  1. After the profiling session is started, click the Get Snapshot by Condition button in .

  2. Select desired conditions in the Automatically get a snapshot section and specify particular values for them:

    • if memory consumption increases by [X] MB - automatically get a snapshot when memory consumption* exceeds the baseline by X MB. The first baseline is a memory consumption on the moment when you click the Start button in the Get Snapshot by Condition window. After the condition takes place, dotMemory gets a snapshot and the memory consumption in that moment becomes a new baseline.

    • if memory consumption increases by [X] % - automatically get a snapshot when memory consumption exceeds the baseline by X percent. The first baseline is a memory consumption on the moment when you click the Start button in the Get Snapshot by Condition window. After the condition takes place, dotMemory gets a snapshot and the memory consumption in that moment becomes a new baseline.

    • if memory consumption exceeds [X] MB - automatically get a snapshot when total memory consumption (absolute value) exceeds X MB.

    • every [X] minutes - automatically get a snapshot every X minutes.

  3. Select the Limit the max number of snapshots to [X] checkbox if you want dotMemory to take no more than X snapshots. This option can be useful if you are limited on the disk space.

  4. Click Start.

To disable collecting snapshots by condition

  1. Click the Get Snapshot by Condition button in .

  2. Click Stop.

Last modified: 21 March 2024