Click or drag to resize

BufferPool Class

Note: This API is now obsolete.

Represents a common buffer pool that can be used by an application.
Inheritance Hierarchy
SystemObject
  GSFBufferPool

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.218-beta+101eee949414e414795e55a6e73d88938f0177b8
Syntax
[ObsoleteAttribute("It is not recommended to use this class because the need for pooling is rare and implementations of pooling can be dangerous.")]
public static class BufferPool
View Source

The BufferPool type exposes the following members.

Methods
 NameDescription
Public methodStatic memberClear Releases all the buffers currently cached in the pool.
Public methodStatic memberReturnBuffer Returns a buffer to the pool.
Public methodStatic memberTakeBuffer Gets a buffer of at least the specified size from the pool.
Top
Remarks

The buffer pool is statically created at application startup and is available for all components and classes within an application domain. Every time you need to use a buffer, you take one from the pool, use it, and return it to the pool when done.

It is very important to return the buffer to the pool when you are finished using it. If you are using a buffer scoped within a method, make sure to use a try/finally so that you can take the buffer within the try and return the buffer within the finally. If you are using a buffer as a member scoped class field, make sure you use the standard dispose pattern and return the buffer in the Dispose method.

Internally this class simply wraps a static instance of the WCF BufferManager.

See Also

Reference

GSF Namespace