Mirror::NetworkReaderPool
Pool of NetworkReaders More...
Public Functions
Name | |
---|---|
PooledNetworkReader | GetReader(byte [] bytes) Get the next reader in the pool |
PooledNetworkReader | GetReader(ArraySegment< byte > segment) Get the next reader in the pool |
void | Recycle(PooledNetworkReader reader) Puts reader back into pool |
Public Properties
Name | |
---|---|
int | Capacity Size of the pool |
Detailed Description
class Mirror::NetworkReaderPool;
Pool of NetworkReaders
Use this pool instead of NetworkReader to reduce memory allocation
Use [Capacity] to change size of pool
Public Functions Documentation
function GetReader
static inline PooledNetworkReader GetReader(
byte [] bytes
)
Get the next reader in the pool
If pool is empty, creates a new Reader
function GetReader
static inline PooledNetworkReader GetReader(
ArraySegment< byte > segment
)
Get the next reader in the pool
If pool is empty, creates a new Reader
function Recycle
static inline void Recycle(
PooledNetworkReader reader
)
Puts reader back into pool
When pool is full, the extra reader is left for the GC
Public Property Documentation
property Capacity
static int Capacity;
Size of the pool
If pool is too small getting readers will causes memory allocation
Default value: 100
Updated on 27 January 2021 at 19:35:29 UTC