Summary

Class:System.Buffers.MemoryPool`1
Assembly:System.Memory
File(s):C:\GitHub\corefx\src\System.Memory\src\System\Buffers\MemoryPool.cs
Covered lines:7
Uncovered lines:0
Coverable lines:7
Total lines:50
Line coverage:100%

Metrics

MethodCyclomatic complexity NPath complexity Sequence coverage Branch coverage
.ctor()10100100
Dispose()10100100
.cctor()10100100

File(s)

C:\GitHub\corefx\src\System.Memory\src\System\Buffers\MemoryPool.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3// See the LICENSE file in the project root for more information.
 4
 5namespace System.Buffers
 6{
 7    /// <summary>
 8    /// Represents a pool of memory blocks.
 9    /// </summary>
 10    public abstract class MemoryPool<T> : IDisposable
 11    {
 112        private static readonly MemoryPool<T> s_shared = new ArrayMemoryPool<T>();
 13
 14        /// <summary>
 15        /// Returns a singleton instance of a MemoryPool based on arrays.
 16        /// </summary>
 117        public static MemoryPool<T> Shared => s_shared;
 18
 19        /// <summary>
 20        /// Returns a memory block capable of holding at least <paramref name="minBufferSize" /> elements of T.
 21        /// </summary>
 22        /// <param name="minBufferSize">If -1 is passed, this is set to a default value for the pool.</param>
 23        public abstract OwnedMemory<T> Rent(int minBufferSize = -1);
 24
 25        /// <summary>
 26        /// Returns the maximum buffer size supported by this pool.
 27        /// </summary>
 28        public abstract int MaxBufferSize { get; }
 29
 30        /// <summary>
 31        /// Constructs a new instance of a memory pool.
 32        /// </summary>
 333        protected MemoryPool() {}
 34
 35        /// <summary>
 36        /// Frees all resources used by the memory pool.
 37        /// </summary>
 38        public void Dispose()
 139        {
 140            Dispose(true);
 141            GC.SuppressFinalize(this);
 142        }
 43
 44        /// <summary>
 45        /// Frees all resources used by the memory pool.
 46        /// </summary>
 47        /// <param name="disposing"></param>
 48        protected abstract void Dispose(bool disposing);
 49    }
 50}

Methods/Properties

.cctor()
Shared()
.ctor()
Dispose()