dotnet / dotnet/BenchmarkDotNet

"Allocated native memory" and "Native memory leak" show wrong values if I use KeepBenchmarkFiles

Open
#2,098 0 comments 0 reactions 0 assignees View on GitHub
Area:Diagnosers bug up-for-grabs
Dominant language
C#
Stars
11.5k
Forks
1.1k
Avg merge
6d 11h
Merged PRs (30d)
12

Description

Steps to reproduce:

1. Clone [the solution](https://github.com/yaskovdev/sandbox/tree/master/BenchmarkDotNetBug).
2. Open PowerShell in the same directory as `BenchmarkDotNetBug.sln` as an admin.
3. Run `.\BuildAndRun.ps1`.
4. Wait a few minutes for the benchmark to finish.

Expected: both "Allocated native memory" and "Native memory leak" are "10 B".
Actual: both "Allocated native memory" and "Native memory leak" are "-".

Remove `KeepBenchmarkFiles` attribute from `MemoryLeak` class and run again. This time everything works as expected.

// Benchmark Process Environment Information:
// Runtime=.NET 6.0.8 (6.0.822.36306), X64 RyuJIT AVX2
// GC=Concurrent Workstation
// HardwareIntrinsics=AVX2,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256
// Job: DefaultJob

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.