diff options
Diffstat (limited to 'sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs')
-rw-r--r-- | sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs b/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs index 0cff6334..64e7c89a 100644 --- a/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs +++ b/sandbox/PerfBenchmarkDotNet/MessagePackWriterBenchmark.cs @@ -4,6 +4,7 @@ extern alias newmsgpack; extern alias oldmsgpack; +using System; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; using Nerdbank.Streams; @@ -12,7 +13,7 @@ namespace PerfBenchmarkDotNet { [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] [CategoriesColumn] - public class MessagePackWriterBenchmark + public class MessagePackWriterBenchmark : IDisposable { private const int RepsOverArray = 300 * 1024; private readonly Sequence<byte> sequence = new Sequence<byte>(); @@ -148,5 +149,19 @@ namespace PerfBenchmarkDotNet offset = 0; } } + + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + this.sequence.Dispose(); + } + } } } |