1

I'm a bit confused about the differences between these two tools. In BenchmarkDotNet, when I benchmark an application while using the MemoryDiagnoser attribute, it indicates 200mb total was allocated on the managed heap after running.

When I run the same program's .exe through dotMemory, the peak of the graph is only 40mb.

Why is BenchmarkDotNet's "Allocated" column showing 5x what dotMemory's "Total Used" column does, in terms of allocated memory? Which is more accurate if I want to know what the peak memory used at any given time was vs how much memory was allocated in total?

I did not understand the answers in a related post, How to interpret the results from BenchmarkDotNet and dotMemory?

Perhaps BenchmarkDotNet is showing the "total amount allocated", while dotMemory is showing the "total memory being used at any given time"?

  • Are you sure your benchmark is set up correctly? 200 mb in a single iteration is an extremely large amount of allocations. Without seeing the benchmark code, it is going to be very difficult to give you a useful answer. – David L Apr 12 '23 at 16:42
  • 1
    200Mb of objects were allocated and part of them were collected during the run. If you open this view in dotMemory, I bet you will see the same 200Mb. https://www.jetbrains.com/help/dotmemory/Analyze_Memory_Allocation.html – Ed Pavlov Apr 12 '23 at 17:37

0 Answers0