Using tracing and diagnostics tools
In this section, we will look at some profiling tools to help you trace and diagnose any issues with your code. By tracing and diagnosing your program, you can identify areas of performance concern and address them. Such concerns might be the number of memory allocations and the number of bytes they are using and identifying the number of objects surviving garbage collection. Such information can be useful in improving memory usage and performance and in preventing and removing memory leaks.
We will look at two offerings from JetBrains, called dotMemory and dotTrace, that are valuable tools in this respect. But first, we will start by looking at the built-in profiler that comes with Visual Studio 2022 called Performance Profiler.
Using the Visual Studio 2022 Performance Profiler
Now we are going to view the performance profile for our project. This will show us the number of objects over time and the way garbage collection is being utilized...