Microsoft.Azure.Amqp.InternalBufferManager.AllocateByteArray C# (CSharp) Method

AllocateByteArray() public static method

public static AllocateByteArray ( int size ) : byte[]
size int
return byte[]
        public static byte[] AllocateByteArray(int size)
        {
            // This will be inlined in retail bits but provides a 
            // common entry point for debugging all buffer allocations 
            // and can be instrumented if necessary. 
            return new byte[size];
        }

Usage Example

Example #1
0
            public override byte[] TakeBuffer(int bufferSize)
            {
                Fx.Assert(bufferSize >= 0, "caller must ensure a non-negative argument");

                BufferPool bufferPool = FindPool(bufferSize);

                if (bufferPool != null)
                {
                    byte[] buffer = bufferPool.Take();
                    if (buffer != null)
                    {
                        bufferPool.DecrementCount();
                        return(buffer);
                    }
                    if (bufferPool.Peak == bufferPool.Limit)
                    {
                        bufferPool.Misses++;
                        if (++totalMisses >= maxMissesBeforeTuning)
                        {
                            TuneQuotas();
                        }
                    }
                    return(InternalBufferManager.AllocateByteArray(bufferPool.BufferSize));
                }
                else
                {
                    return(InternalBufferManager.AllocateByteArray(bufferSize));
                }
            }
All Usage Examples Of Microsoft.Azure.Amqp.InternalBufferManager::AllocateByteArray