Run with Valgrind Memcheck
On Linux and macOS platforms CLion integrates with Valgrind Memcheck to help you detect memory errors.
It lets you run targets with Valgrind Memcheck and then get the results in a special tab in the Run tool window. Users can run both regular targets and unit tests targets with Memcheck.
Valgrind is also available on Windows with WSL toolchain.
Run with Google Sanitizers
To detect addressability issues, memory leaks, data races, and uninitialized memory issues on Linux and macOS, use Google Sanitizers integration in CLion.
In case you use Clang >= 3.8.0 or GCC >= 5.0.0, when you run/debug your application or unit tests with
-fsanitize compilation flag, CLion visualizes the sanitizers output in a "Sanitizer" tab in the run tool window. It allows you to review the list of errors and their traces in the IDE, navigate to sources, preview the sources or inspect the frame information.
CLion integrates with CPU Profiler on Linux (Perf) and macOS (DTrace).
You can run the profiler right from the IDE and review the analysis results in a dedicated tool window (View | Tool Windows | CPU Profiler).
Use the flame chart, call tree and method lists to get a better overview of the possible performance issues in your code. Navigate to the source code to locate the issues in the code base.