예제 #1
0
        public ArrayPool()
        {
            _buckets = new SlotBuff[BucketHelper.BucketCount];
            for (var i = 0; i < BucketHelper.BucketCount; ++i)
            {
                var maxSlotSize = BucketHelper.GetMaxSizeForBucket(i);

                var slotBuff = new SlotBuff();
                _buckets[i] = slotBuff;

                for (var j = 0; j < SLOT_COUNT; ++j)
                {
                    if (!slotBuff.TryPush(new T[maxSlotSize]))
                    {
                        throw new InvalidOperationException();
                    }
                }
            }
        }