/// <summary>
        /// Resizes the memory allocation.
        /// </summary>
        /// <param name="newSize">The new size of the allocation.</param>
        public virtual void Resize(int newSize)
        {
            this.Memory = _privateHeap.Reallocate(0, this.Memory, newSize);
            this.Size   = newSize;

#if ENABLE_STATISTICS
            System.Threading.Interlocked.Increment(ref _reallocatedCount);
#endif
        }
Exemple #2
0
        /// <summary>
        /// Resizes the memory allocation.
        /// </summary>
        /// <param name="newSize">The new size of the allocation.</param>
        public virtual void Resize(int newSize)
        {
            if (newSize > 0)
            {
                GC.RemoveMemoryPressure(this.Size);
            }

            this.Memory = _privateHeap.Reallocate(this.Memory, newSize);
            this.Size   = newSize;

#if ENABLE_STATISTICS
            System.Threading.Interlocked.Increment(ref _reallocatedCount);
#endif
            if (this.Size > 0)
            {
                GC.AddMemoryPressure(this.Size);
            }
        }