A static class in Alta.NetworkTransport.Runtime, Alta.NetworkingTransport.
Thread-safe pool of 64 KB byte arrays for received network messages, so the receive path doesn't allocate a new buffer each time.
Fields
| Member | What it is |
|---|
const int MaximumMessageSize | Size of every pooled buffer: 65535 bytes. |
const int MaximumPoolSize | Cap on pooled buffers (100). Buffers returned past it are dropped. |
3 private and internal fields
| Member | What it is |
|---|
private static bool isMonitoring | When true, the editor logs a warning on a full pool. Always false in this build. |
private static readonly Logger Logger | NLog logger for this class. |
private static readonly ConcurrentBag<byte[]> Pool | The ConcurrentBag holding free buffers. |
Methods
| Member | What it is |
|---|
static byte[] Get() | Takes a buffer from the pool, or allocates a new 65535-byte array if it is empty. |
static void Put(byte[] bytes) | Returns a buffer to the pool unless it already holds more than 100. Callers include the server packet receivers. |