FirstGearGames / FishNet

FishNet: Unity Networking Evolved.
Other
1.38k stars 149 forks source link

Fix RingBuffer Capacity #724

Closed jimdroberts closed 3 months ago

jimdroberts commented 4 months ago

ArrayPool.Shared.Rent can return variable length arrays which may be slightly larger than the specified capacity due to more efficient memory block sizes. We may as well take advantage of that extra memory.

Example: A capacity of 15 will generally return an array of size 16 instead.

FirstGearGames commented 4 months ago

Going to have to deny this one. The capacity is intentionally said to what the user specifies, even if the array is larger. This is so the buffer doesn't keep more than specified in memory.