コード例 #1
0
        public bool Alloc(int size, out IBuffer buffer)
        {
            if (size != this._allocationSize)
            {
                buffer = null;
                return(false);
            }

            if (this._bufferIndexPool.Count > 0)
            {
                buffer = new DefaultBuffer(this._coreBuffer, this._bufferIndexPool.Pop(), this._currentIndex);
                return(true);
            }

            if ((_coreBuffer.Length - size) < this._currentIndex)
            {
                buffer = null;
                return(false);
            }

            buffer              = new DefaultBuffer(this._coreBuffer, this._currentIndex, size);
            this._currentIndex += size;

            return(true);
        }
コード例 #2
0
 public bool Alloc(int size, out IBuffer buffer)
 {
     buffer = new DefaultBuffer(new byte[size], size, 0);
     return(true);
 }