New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak and crash with [Setup] #368
Comments
Hey @JamesNK. In BenchmarkDotNet, we assume that a benchmark method shouldn't produce any side-effects. In your benchmark class, you have the following method: [Benchmark]
public void AddPerformance()
{
_largeJArraySample.Add(1);
} Be default, our benchmark engine could run your method as many times as it required. Possible solution:
|
Hmmm, ok. I didn't realize the framework did that, but I thought that the Setup was run before each iteration to keep the state steady. That was the impression I got when reading the documentation. http://benchmarkdotnet.org/Advanced/Setup.htm
|
Probably, we have to update the documentation. |
It might be because our terminology around 'operations' and 'iterations' is confusing, from How it works:
So an invocation of the target method is an operation. |
@mattwarren, thanks for the clarification. I definitely have to improve our documentation. |
We have quite good docs about setup now. +cleanup and global/interation/targeted versions. I am closing this one. |
I have this file: https://github.com/JamesNK/Newtonsoft.Json/blob/9b9c3da624cfe92da402049fce9344d06f451da6/Src/Newtonsoft.Json.Tests/Benchmarks/LargeJArrayBenchmarks.cs
When the benchmarks are run memory usage slowly increases until the runner crashes with an
OutOfMemoryException
.The text was updated successfully, but these errors were encountered: