Skip to content

Mirror::NetworkWriterPool

Pool of NetworkWriters More...

Public Functions

Name
PooledNetworkWriter GetWriter()
Get the next writer in the pool
void Recycle(PooledNetworkWriter writer)
Puts writer back into pool

Public Properties

Name
int Capacity
Size of the pool

Detailed Description

class Mirror::NetworkWriterPool;

Pool of NetworkWriters

Use this pool instead of NetworkWriter to reduce memory allocation

Use [Capacity] to change size of pool

Public Functions Documentation

function GetWriter

static inline PooledNetworkWriter GetWriter()

Get the next writer in the pool

If pool is empty, creates a new Writer

function Recycle

static inline void Recycle(
    PooledNetworkWriter writer
)

Puts writer back into pool

When pool is full, the extra writer is left for the GC

Public Property Documentation

property Capacity

static int Capacity;

Size of the pool

If pool is too small getting writers will causes memory allocation

Default value: 100


Updated on 20 January 2021 at 20:00:02 UTC