示例#1
0
        /** <inheritdoc /> */
        public override void Reallocate(int cap)
        {
            // Try doubling capacity to avoid excessive allocations.
            int doubledCap = ((PlatformMemoryUtils.Capacity(MemPtr) + 16) << 1) - 16;

            if (doubledCap > cap)
            {
                cap = doubledCap;
            }

            PlatformMemoryUtils.ReallocateUnpooled(MemPtr, cap);
        }
        /** <inheritdoc /> */
        public override void Reallocate(int cap)
        {
            // Try doubling capacity to avoid excessive allocations.
            int doubledCap = PlatformMemoryUtils.Capacity(MemPtr) << 1;

            if (doubledCap > cap)
            {
                cap = doubledCap;
            }

            _pool.Reallocate(MemPtr, cap);
        }