void EnsureCapacityTest(int size, int expect) { BufferPoolEx.EnsureCapacity(size); for (int i = 0; i < BufferPoolEx.pool.Length; ++i) { var pool = BufferPoolEx.pool[i]; Debug.Assert(pool.Count == expect); for (int j = 0; j < pool.Count; ++j) { byte[] bytes = pool[j]; Debug.Assert(bytes != null); Debug.Assert(bytes.Length == ((i + 1) << BufferPoolEx.shift)); } } }
void Awake() { instance = this; BufferPoolEx.EnsureCapacity(16); }