public BufferPool(long slabSize, int initialSlabs, int subsequentSlabs)
{
if (slabSize < 1) throw new ArgumentException("slabSize must be equal to or greater than 1");
if (initialSlabs < 1) throw new ArgumentException("initialSlabs must be equal to or greater than 1");
if (subsequentSlabs < 1) throw new ArgumentException("subsequentSlabs must be equal to or greater than 1");
if (slabSize > MaximumSlabSize) throw new ArgumentException("slabSize cannot be larger BufferPool.MaximumSlabSize");
this.slabSize = slabSize > MinimumSlabSize ? slabSize : MinimumSlabSize;
this.initialSlabs = initialSlabs;
this.subsequentSlabs = subsequentSlabs;
// lock is unnecessary in this instance constructor
//lock (syncSlabList)
//{
if (slabs.Count == 0)
{
SetSingleSlabPool(initialSlabs == 1); //Assume for optimization reasons that it's a single slab pool if the number of initial slabs is 1
for (int i = 0; i < initialSlabs; i++)
{
slabs.Add(new MemorySlab(slabSize, this));
}
firstSlab = slabs[0];
}
//}
}