Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }