Table of Contents

Class MemoryStreamPool

Namespace
CodeProject.ObjectPool.Specialized
Assembly
CodeProject.ObjectPool.dll

An IObjectPool<T> ready to be used. MemoryStream management can be further configured using the MinimumMemoryStreamCapacity and MaximumMemoryStreamCapacity properties.

public sealed class MemoryStreamPool : ObjectPool<PooledMemoryStream>, IMemoryStreamPool, IObjectPool<PooledMemoryStream>
Inheritance
MemoryStreamPool
Implements
Inherited Members

Constructors

MemoryStreamPool()

Builds the specialized pool.

public MemoryStreamPool()

Fields

DefaultMaximumMemoryStreamCapacity

Default maximum memory stream capacity. Shared by all IMemoryStreamPool instances, defaults to 512KB.

public const int DefaultMaximumMemoryStreamCapacity = 524288

Field Value

int

DefaultMinimumMemoryStreamCapacity

Default minimum memory stream capacity. Shared by all IMemoryStreamPool instances, defaults to 4KB.

public const int DefaultMinimumMemoryStreamCapacity = 4096

Field Value

int

Properties

Instance

Thread-safe pool instance.

public static IMemoryStreamPool Instance { get; }

Property Value

IMemoryStreamPool

MaximumMemoryStreamCapacity

Maximum capacity a MemoryStream might have in order to be able to return to pool. Defaults to DefaultMaximumMemoryStreamCapacity.

public int MaximumMemoryStreamCapacity { get; set; }

Property Value

int

MinimumMemoryStreamCapacity

Minimum capacity a MemoryStream should have when created and this is the minimum capacity of all streams stored in the pool. Defaults to DefaultMinimumMemoryStreamCapacity.

public int MinimumMemoryStreamCapacity { get; set; }

Property Value

int