April 2018
Intermediate to advanced
300 pages
7h 41m
English
With BenchmarkDotnet, we can also diagnose any problems with the memory and measure the number of allocated bytes and garbage collection.
It can be implemented using a MemoryDiagnoser attribute at the class level. To start, let's just add the MemoryDiagnoser attribute to the TestBenchmark class that we created in the last example:
[MemoryDiagnoser]
public class TestBenchmark {}
Rerun the application. Now it will collect other memory allocation and garbage collection information and generate logs accordingly:

In the preceding table, the Gen 0 and Gen 1 columns each contain the number of that particular ...