/// <summary> /// Gets the capacity allocated for a power. /// </summary> /// <param name="power">Power to check.</param> /// <returns>Allocated capacity for the given power.</returns> public int GetCapacityForPower(int power) { SpanHelper.ValidatePower(power); return(pools[power].BlockCount * pools[power].BlockSize); }
/// <summary> /// Ensures that the pool associated with a given power has at least a certain amount of capacity, measured in bytes. /// </summary> /// <param name="byteCount">Minimum number of bytes to require for the power pool.</param> /// <param name="power">Power associated with the pool to check.</param> public void EnsureCapacityForPower(int byteCount, int power) { SpanHelper.ValidatePower(power); ValidatePinnedState(true); pools[power].EnsureCapacity(byteCount); }