Try our conversational search powered by Generative AI!

Class MemoryBufferPool

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Handle a pool of large memory buffers

Inheritance
System.Object
MemoryBufferPool
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core.Internal
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public class MemoryBufferPool
Remarks

The buffers will be at least 87040 bytes (>85000 so as to go into the large object heap)

Constructors

MemoryBufferPool()

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Construct a pool with a default memory buffer size. It is thread safe.

Declaration
public MemoryBufferPool()
Remarks

The normal case is to have static field representing the pool so that many threads can share it.

MemoryBufferPool(Int32)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Construct a pool. It is thread safe.

Declaration
public MemoryBufferPool(int bufferSize)
Parameters
Type Name Description
System.Int32 bufferSize

The size of each buffer. May be rounded upwards - always check the buffer Lenth property

Remarks

The normal case is to have static field representing the pool so that many threads can share it.

Properties

Instance

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the singleton instance. It is thread-safe.

Declaration
public static MemoryBufferPool Instance { get; }
Property Value
Type Description
MemoryBufferPool

The instance.

Remarks

Whenever a MemoryBufferPool is required, it is recommended to use the singleton instance available here, as it allows for efficient sharing and re-use of buffers. Only if a pool requiring significantly different characterstics should a new pool be instantiated.

PerformanceCounters

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the collection of performance counters

Declaration
public MemoryBufferPool.Counters PerformanceCounters { get; }
Property Value
Type Description
MemoryBufferPool.Counters

Methods

Allocate()

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Get a buffer. There is no guarantee of the size returned.

Declaration
public byte[] Allocate()
Returns
Type Description
System.Byte[]

A buffer. Check the Length property to know how large it is.

Release(Byte[])

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Actively re-release a buffer. Do not use it afterwards - it may be re-used at any time.

Declaration
public void Release(byte[] theBuffer)
Parameters
Type Name Description
System.Byte[] theBuffer

A buffer that you want re-used. It does not need to allocated by this manager.

Release(ArrayList)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Acitvely re-release an ArrayList of buffers. Do not use these afterwards. The ArrayList is cleared.

Declaration
public void Release(ArrayList theBuffers)
Parameters
Type Name Description
System.Collections.ArrayList theBuffers

An ArrayList of byte[]'s. Cleared after call

Remarks

This method is to optimize for the case we have many buffers, since we'll do it all in one lock

Extension Methods