예제 #1
0
        bool Allocate(MemoryRegionCache cache, PooledByteBuffer <T> buf, int reqCapacity)
        {
            if (cache is null)
            {
                // no cache found so just return false here
                return(false);
            }
            bool allocated = cache.Allocate(buf, reqCapacity, this);

            if (++_allocations >= _freeSweepAllocationThreshold)
            {
                _allocations = 0;
                Trim();
            }
            return(allocated);
        }
예제 #2
0
        bool Allocate(MemoryRegionCache cache, PooledArrayBuffer <T> buf, int reqCapacity)
        {
            if (cache == null)
            {
                // no cache found so just return false here
                return(false);
            }
            bool allocated = cache.Allocate(buf, reqCapacity);

            if (++this.allocations >= this.freeSweepAllocationThreshold)
            {
                this.allocations = 0;
                this.Trim();
            }
            return(allocated);
        }