/// <summary> /// Creates a new memory allocation with the specified size. /// </summary> /// <param name="size">The amount of memory, in bytes, to allocate.</param> /// <param name="flags">Any flags to use.</param> public MemoryAlloc(int size, HeapFlags flags) { this.Memory = _privateHeap.Allocate(flags, size); this.Size = size; #if ENABLE_STATISTICS System.Threading.Interlocked.Increment(ref _allocatedCount); #endif }
/// <summary> /// Creates a new memory allocation with the specified size. /// </summary> /// <param name="size">The amount of memory, in bytes, to allocate.</param> public MemoryAlloc(int size) { this.Memory = _privateHeap.Allocate(size); this.Size = size; #if ENABLE_STATISTICS System.Threading.Interlocked.Increment(ref _allocatedCount); #endif if (size > 0) { GC.AddMemoryPressure(size); } }