Skip to main content

RecyclableMemoryStreamManager

Manages pools of RecyclableMemoryStream objects.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

Assembly: ServiceStack.Text.dll
View Source
Declaration
public sealed class RecyclableMemoryStreamManager

Properties

BlockSize

The size of each block. It must be set at creation and cannot be changed.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public int BlockSize { get; }

LargeBufferMultiple

All buffers are multiples/exponentials of this number. It must be set at creation and cannot be changed.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public int LargeBufferMultiple { get; }

UseMultipleLargeBuffer

Use multiple large buffer allocation strategy. It must be set at creation and cannot be changed.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public bool UseMultipleLargeBuffer { get; }

UseExponentialLargeBuffer

Use exponential large buffer allocation strategy. It must be set at creation and cannot be changed.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public bool UseExponentialLargeBuffer { get; }

MaximumBufferSize

Gets the maximum buffer size.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public int MaximumBufferSize { get; }

SmallPoolFreeSize

Number of bytes in small pool not currently in use

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public long SmallPoolFreeSize { get; }

SmallPoolInUseSize

Number of bytes currently in use by stream from the small pool

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public long SmallPoolInUseSize { get; }

LargePoolFreeSize

Number of bytes in large pool not currently in use

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public long LargePoolFreeSize { get; }

LargePoolInUseSize

Number of bytes currently in use by streams from the large pool

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public long LargePoolInUseSize { get; }

SmallBlocksFree

How many blocks are in the small pool

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public long SmallBlocksFree { get; }

LargeBuffersFree

How many buffers are in the large pool

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public long LargeBuffersFree { get; }

MaximumFreeSmallPoolBytes

How many bytes of small free blocks to allow before we start dropping those returned to us.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public long MaximumFreeSmallPoolBytes { get; set; }

MaximumFreeLargePoolBytes

How many bytes of large free buffers to allow before we start dropping those returned to us.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public long MaximumFreeLargePoolBytes { get; set; }

MaximumStreamCapacity

Maximum stream capacity in bytes. Attempts to set a larger capacity will result in an exception.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public long MaximumStreamCapacity { get; set; }

GenerateCallStacks

Whether to save callstacks for stream allocations. This can help in debugging. It should NEVER be turned on generally in production.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public bool GenerateCallStacks { get; set; }

AggressiveBufferReturn

Whether dirty buffers can be immediately returned to the buffer pool. E.g. when GetBuffer() is called on a stream and creates a single large buffer, if this setting is enabled, the other blocks will be returned to the buffer pool immediately. Note when enabling this setting that the user is responsible for ensuring that any buffer previously retrieved from a stream which is subsequently modified is not used after modification (as it may no longer be valid).

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public bool AggressiveBufferReturn { get; set; }

ThrowExceptionOnToArray

Causes an exception to be thrown if ToArray is ever called.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public bool ThrowExceptionOnToArray { get; set; }

Fields

DefaultBlockSize

Default block size, in bytes

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public const int DefaultBlockSize = 131072

DefaultLargeBufferMultiple

Default large buffer multiple, in bytes

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public const int DefaultLargeBufferMultiple = 1048576

DefaultMaximumBufferSize

Default maximum buffer size, in bytes

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public const int DefaultMaximumBufferSize = 134217728

Methods

GetStream()

Retrieve a new MemoryStream object with no tag and a default initial capacity.

View Source
Declaration
public MemoryStream GetStream()
Returns

System.IO.MemoryStream: A MemoryStream.

GetStream(Guid)

Retrieve a new MemoryStream object with no tag and a default initial capacity.

View Source
Declaration
public MemoryStream GetStream(Guid id)
Returns

System.IO.MemoryStream: A MemoryStream.

Parameters
TypeNameDescription
System.GuididA unique identifier which can be used to trace usages of the stream.

|

GetStream(String)

Retrieve a new MemoryStream object with the given tag and a default initial capacity.

View Source
Declaration
public MemoryStream GetStream(string tag)
Returns

System.IO.MemoryStream: A MemoryStream.

Parameters
TypeNameDescription
System.StringtagA tag which can be used to track the source of the stream.

|

GetStream(Guid, String)

Retrieve a new MemoryStream object with the given tag and a default initial capacity.

View Source
Declaration
public MemoryStream GetStream(Guid id, string tag)
Returns

System.IO.MemoryStream: A MemoryStream.

Parameters
TypeNameDescription
System.GuididA unique identifier which can be used to trace usages of the stream.

| | System.String | tag | A tag which can be used to track the source of the stream.

|

GetStream(String, Int32)

Retrieve a new MemoryStream object with the given tag and at least the given capacity.

View Source
Declaration
public MemoryStream GetStream(string tag, int requiredSize)
Returns

System.IO.MemoryStream: A MemoryStream.

Parameters
TypeNameDescription
System.StringtagA tag which can be used to track the source of the stream.

| | System.Int32 | requiredSize | The minimum desired capacity for the stream.

|

GetStream(Guid, String, Int32)

Retrieve a new MemoryStream object with the given tag and at least the given capacity.

View Source
Declaration
public MemoryStream GetStream(Guid id, string tag, int requiredSize)
Returns

System.IO.MemoryStream: A MemoryStream.

Parameters
TypeNameDescription
System.GuididA unique identifier which can be used to trace usages of the stream.

| | System.String | tag | A tag which can be used to track the source of the stream.

| | System.Int32 | requiredSize | The minimum desired capacity for the stream.

|

GetStream(Guid, String, Int32, Boolean)

Retrieve a new MemoryStream object with the given tag and at least the given capacity, possibly using a single contiguous underlying buffer.

Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream.

View Source
Declaration
public MemoryStream GetStream(Guid id, string tag, int requiredSize, bool asContiguousBuffer)
Returns

System.IO.MemoryStream: A MemoryStream. Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream.

Parameters
TypeNameDescription
System.GuididA unique identifier which can be used to trace usages of the stream.

Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream. | | System.String | tag | A tag which can be used to track the source of the stream. Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream. | | System.Int32 | requiredSize | The minimum desired capacity for the stream. Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream. | | System.Boolean | asContiguousBuffer | Whether to attempt to use a single contiguous buffer. Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream. |

GetStream(String, Int32, Boolean)

Retrieve a new MemoryStream object with the given tag and at least the given capacity, possibly using a single contiguous underlying buffer.

Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream.

View Source
Declaration
public MemoryStream GetStream(string tag, int requiredSize, bool asContiguousBuffer)
Returns

System.IO.MemoryStream: A MemoryStream. Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream.

Parameters
TypeNameDescription
System.StringtagA tag which can be used to track the source of the stream.

Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream. | | System.Int32 | requiredSize | The minimum desired capacity for the stream. Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream. | | System.Boolean | asContiguousBuffer | Whether to attempt to use a single contiguous buffer. Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream. |

GetStream(Guid, String, Byte[], Int32, Int32)

Retrieve a new MemoryStream object with the given tag and with contents copied from the provided buffer. The provided buffer is not wrapped or used after construction.

The new stream's position is set to the beginning of the stream when returned.

View Source
Declaration
public MemoryStream GetStream(Guid id, string tag, byte[] buffer, int offset, int count)
Returns

System.IO.MemoryStream: A MemoryStream. The new stream's position is set to the beginning of the stream when returned.

Parameters
TypeNameDescription
System.GuididA unique identifier which can be used to trace usages of the stream.

The new stream's position is set to the beginning of the stream when returned. | | System.String | tag | A tag which can be used to track the source of the stream. The new stream's position is set to the beginning of the stream when returned. | | System.Byte[] | buffer | The byte buffer to copy data from. The new stream's position is set to the beginning of the stream when returned. | | System.Int32 | offset | The offset from the start of the buffer to copy from. The new stream's position is set to the beginning of the stream when returned. | | System.Int32 | count | The number of bytes to copy from the buffer. The new stream's position is set to the beginning of the stream when returned. |

GetStream(Byte[])

Retrieve a new MemoryStream object with the contents copied from the provided buffer. The provided buffer is not wrapped or used after construction.

The new stream's position is set to the beginning of the stream when returned.

View Source
Declaration
public MemoryStream GetStream(byte[] buffer)
Returns

System.IO.MemoryStream: A MemoryStream. The new stream's position is set to the beginning of the stream when returned.

Parameters
TypeNameDescription
System.Byte[]bufferThe byte buffer to copy data from.

The new stream's position is set to the beginning of the stream when returned. |

GetStream(String, Byte[], Int32, Int32)

Retrieve a new MemoryStream object with the given tag and with contents copied from the provided buffer. The provided buffer is not wrapped or used after construction.

The new stream's position is set to the beginning of the stream when returned.

View Source
Declaration
public MemoryStream GetStream(string tag, byte[] buffer, int offset, int count)
Returns

System.IO.MemoryStream: A MemoryStream. The new stream's position is set to the beginning of the stream when returned.

Parameters
TypeNameDescription
System.StringtagA tag which can be used to track the source of the stream.

The new stream's position is set to the beginning of the stream when returned. | | System.Byte[] | buffer | The byte buffer to copy data from. The new stream's position is set to the beginning of the stream when returned. | | System.Int32 | offset | The offset from the start of the buffer to copy from. The new stream's position is set to the beginning of the stream when returned. | | System.Int32 | count | The number of bytes to copy from the buffer. The new stream's position is set to the beginning of the stream when returned. |

Events

BlockCreated

Triggered when a new block is created.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.EventHandler BlockCreated
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.EventHandler

BlockDiscarded

Triggered when a new block is created.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.EventHandler BlockDiscarded
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.EventHandler

LargeBufferCreated

Triggered when a new large buffer is created.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.EventHandler LargeBufferCreated
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.EventHandler

StreamCreated

Triggered when a new stream is created.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.EventHandler StreamCreated
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.EventHandler

StreamDisposed

Triggered when a stream is disposed.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.EventHandler StreamDisposed
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.EventHandler

StreamFinalized

Triggered when a stream is finalized.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.EventHandler StreamFinalized
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.EventHandler

StreamLength

Triggered when a stream is finalized.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.StreamLengthReportHandler StreamLength
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.StreamLengthReportHandler

StreamConvertedToArray

Triggered when a user converts a stream to array.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.EventHandler StreamConvertedToArray
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.EventHandler

LargeBufferDiscarded

Triggered when a large buffer is discarded, along with the reason for the discard.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.LargeBufferDiscardedEventHandler LargeBufferDiscarded
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.LargeBufferDiscardedEventHandler

UsageReport

Periodically triggered to report usage statistics.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

View Source
Declaration
public event RecyclableMemoryStreamManager.UsageReportEventHandler UsageReport
Event Type

ServiceStack.Text.RecyclableMemoryStreamManager.UsageReportEventHandler