ServerToolkit.BufferManagement.BufferPool Class Reference

Provides a pool of buffers that can be used to efficiently allocate memory for asynchronous socket operations More...

Inherits ServerToolkit.BufferManagement.IBufferPool.

Public Member Functions

 BufferPool (long slabSize, int initialSlabs, int subsequentSlabs)
 Initializes a new instance of the BufferPool class More...
 
IBuffer GetBuffer (long size)
 Creates a buffer of the specified size More...
 
IBuffer GetBuffer (long size, byte[] filledWith)
 Creates a buffer of the specified size, filled with the contents of a specified byte array More...
 

Static Public Attributes

const int MinimumSlabSize = 92160
 The minimum size of a slab. More...
 
const long MaximumSlabSize = ((long)int.MaxValue) + 1
 The maximum size of a slab. More...
 

Properties

int InitialSlabs [get]
 Gets the initial number of slabs created More...
 
int SubsequentSlabs [get]
 Gets the additional number of slabs to be created at a time More...
 
long SlabSize [get]
 Gets the slab size, in bytes More...
 

Detailed Description

Provides a pool of buffers that can be used to efficiently allocate memory for asynchronous socket operations

Constructor & Destructor Documentation

◆ BufferPool()

ServerToolkit.BufferManagement.BufferPool.BufferPool ( long  slabSize,
int  initialSlabs,
int  subsequentSlabs 
)

Initializes a new instance of the BufferPool class

Parameters
slabSizeLength, in bytes, of a slab in the BufferPool
initialSlabsNumber of slabs to create initially
subsequentSlabsNumber of additional slabs to create at a time

Member Function Documentation

◆ GetBuffer() [1/2]

IBuffer ServerToolkit.BufferManagement.BufferPool.GetBuffer ( long  size)

Creates a buffer of the specified size

Parameters
sizeBuffer size, in bytes
Returns
IBuffer object of requested size


◆ GetBuffer() [2/2]

IBuffer ServerToolkit.BufferManagement.BufferPool.GetBuffer ( long  size,
byte[]  filledWith 
)

Creates a buffer of the specified size, filled with the contents of a specified byte array

Parameters
sizeBuffer size, in bytes
filledWithByte array to copy to buffer
Returns
IBuffer object of requested size

Member Data Documentation

◆ MaximumSlabSize

const long ServerToolkit.BufferManagement.BufferPool.MaximumSlabSize = ((long)int.MaxValue) + 1
static

The maximum size of a slab.

◆ MinimumSlabSize

const int ServerToolkit.BufferManagement.BufferPool.MinimumSlabSize = 92160
static

The minimum size of a slab.

Property Documentation

◆ InitialSlabs

int ServerToolkit.BufferManagement.BufferPool.InitialSlabs
get

Gets the initial number of slabs created

◆ SlabSize

long ServerToolkit.BufferManagement.BufferPool.SlabSize
get

Gets the slab size, in bytes

◆ SubsequentSlabs

int ServerToolkit.BufferManagement.BufferPool.SubsequentSlabs
get

Gets the additional number of slabs to be created at a time


The documentation for this class was generated from the following file:
  • Stormancer.Unity/Infrastructure/BufferPool/BufferObjects.cs