Skip to content

Commit 7250970

Browse files
authored
chore: fix flaky memorydiagnoser tests on macos (#2813)
1 parent 8b62787 commit 7250970

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/BenchmarkDotNet.IntegrationTests/MemoryDiagnoserTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,14 @@ public void AllocationQuantumIsNotAnIssueForNetCore21Plus(IToolchain toolchain)
244244
{
245245
long objectAllocationOverhead = IntPtr.Size * 2; // pointer to method table + object header word
246246
long arraySizeOverhead = IntPtr.Size; // array length
247+
int warmupCount = OsDetector.IsMacOS()
248+
? 5 // Workaround setting for macos. https://github.com/dotnet/BenchmarkDotNet/issues/2779
249+
: 0; // Other OS don't need warmup
247250

248251
AssertAllocations(toolchain, typeof(TimeConsuming), new Dictionary<string, long>
249252
{
250253
{ nameof(TimeConsuming.SixtyFourBytesArray), 64 + objectAllocationOverhead + arraySizeOverhead }
251-
}, warmupCount: 2);
254+
}, warmupCount: warmupCount);
252255
}
253256

254257
public class MultiThreadedAllocation

0 commit comments

Comments
 (0)