public IMemoryOwner <byte> AllocateByte(int length) { ArrayPool <byte> pool = length > 8192 ? arrayBytePool : ArrayPool <byte> .Shared; byte[] charArray = pool.Rent(length); var buffer = new PooledBuffer <byte>(charArray, length, pool); return(buffer); }
public IMemoryOwner <char> AllocateChar(int length) { ArrayPool <char> pool = length > 8192 ? arrayCharPool : ArrayPool <char> .Shared; char[] charArray = pool.Rent(length); var buffer = new PooledBuffer <char>(charArray, length, pool); return(buffer); }