Tiered pool for ByteArraySlices. Reduces the allocations once enough slices are available.
More...
|
int?? | MinStackIndex [get, set] |
| Requests for buffers smaller than 2^minStackIndex will use 2^minStackIndex. This value avoids allocations of smaller rarely used buffers. Set this to a lower value if you will never need sizes larger than byte[2^minStackIndex] More...
|
|
int | AllocationCounter [get] |
| Count of allocations this pool did. More...
|
|
Tiered pool for ByteArraySlices. Reduces the allocations once enough slices are available.
◆ ByteArraySlicePool()
ExitGames.Client.Photon.ByteArraySlicePool.ByteArraySlicePool |
( |
| ) |
|
|
inline |
◆ Acquire() [1/2]
ByteArraySlice ExitGames.Client.Photon.ByteArraySlicePool.Acquire |
( |
byte[] |
buffer, |
|
|
int |
offset = 0 , |
|
|
int |
count = 0 |
|
) |
| |
|
inline |
Get a ByteArraySlice from pool. This overload handles user supplied byte[] and byte count and can be used as a non-boxing alternative to ArraySegment<byte>.
◆ Acquire() [2/2]
ByteArraySlice ExitGames.Client.Photon.ByteArraySlicePool.Acquire |
( |
int |
minByteCount | ) |
|
|
inline |
Get byte[] wrapper from pool. This overload accepts a bytecount and will return a wrapper with a byte[] that size or greater.
◆ ClearPools()
void ExitGames.Client.Photon.ByteArraySlicePool.ClearPools |
( |
int |
lower = 0 , |
|
|
int |
upper = int.MaxValue |
|
) |
| |
|
inline |
Clears all pool items with byte array sizes between lower and upper inclusively.
Use this if you sent some unusually large RaiseEvents and believe the buffers of that size will not be needed again, and you would like to free up the buffer memory.
◆ Release()
bool ExitGames.Client.Photon.ByteArraySlicePool.Release |
( |
ByteArraySlice |
slice | ) |
|
|
inline |
Releasing a ByteArraySlice, will put it back into the pool, if it was acquired from one.
- Parameters
-
- Returns
- True if this slice was returned to some pool. False if not.
◆ AllocationCounter
int ExitGames.Client.Photon.ByteArraySlicePool.AllocationCounter |
|
get |
Count of allocations this pool did.
◆ MinStackIndex
int?? ExitGames.Client.Photon.ByteArraySlicePool.MinStackIndex |
|
getset |
Requests for buffers smaller than 2^minStackIndex will use 2^minStackIndex. This value avoids allocations of smaller rarely used buffers. Set this to a lower value if you will never need sizes larger than byte[2^minStackIndex]
The documentation for this class was generated from the following file: