Esempio n. 1
0
        /** <inheritdoc /> */
        public override void Reallocate(int cap)
        {
            // Try doubling capacity to avoid excessive allocations.
            int doubledCap = PlatformMemoryUtils.GetCapacity(Pointer) << 1;

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

            PlatformMemoryPool.Reallocate(Pointer, cap);
        }
Esempio n. 2
0
        /** <inheritdoc /> */
        public override void Reallocate(int cap)
        {
            // Try doubling capacity to avoid excessive allocations.
            int doubledCap = ((PlatformMemoryUtils.GetCapacity(Pointer) + 16) << 1) - 16;

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

            PlatformMemoryUtils.ReallocateUnpooled(Pointer, cap);
        }