public Heap(HeapFlags flags, int reserveSize, int commitSize) { _heap = Win32.RtlCreateHeap( flags, IntPtr.Zero, reserveSize.ToIntPtr(), commitSize.ToIntPtr(), IntPtr.Zero, IntPtr.Zero ); if (_heap == IntPtr.Zero) throw new OutOfMemoryException(); }
public Heap(HeapFlags flags, int reserveSize, int commitSize) { this.HeapHandle = NativeApi.RtlCreateHeap( flags, IntPtr.Zero, reserveSize.ToIntPtr(), commitSize.ToIntPtr(), IntPtr.Zero, IntPtr.Zero ); this.Flags = flags; if (this.HeapHandle == IntPtr.Zero) throw new OutOfMemoryException(); }
public static extern UIntPtr HeapSize(IntPtr heapHandle, HeapFlags flags, IntPtr blockAddress);
private static extern bool HeapFree(IntPtr heapHandle, [MarshalAs(UnmanagedType.U4)] HeapFlags heapFlags, UIntPtr lpMem);
public static extern IntPtr HeapReAlloc(IntPtr heapHandle, HeapFlags flags, IntPtr blockAddress, UIntPtr sizeInBytes);
public Heap(HeapFlags flags) : this(flags, 0, 0) { }
public IntPtr Allocate(HeapFlags flags, int size) { IntPtr memory = Win32.RtlAllocateHeap(_heap, flags, size.ToIntPtr()); if (memory == IntPtr.Zero) throw new OutOfMemoryException(); return memory; }
public static extern bool HeapFree(IntPtr hHeap, HeapFlags flags, IntPtr block);
internal extern static IntPtr HeapFree(IntPtr hHeap, HeapFlags dwFlags, IntPtr lpMem);
public Heap(HeapFlags flags) : this(flags, 0, 0) { }
public static extern IntPtr HeapCreate(HeapFlags flOptions, uint dwInitialsize, uint dwMaximumSize);
public static extern bool HeapFree(IntPtr hHeap, HeapFlags flags, IntPtr block);
private Heap(IntPtr heap) { _heap = heap; _flags = 0; }
public static extern IntPtr HeapAlloc(IntPtr hHeap, HeapFlags flags, IntPtr size);
public static extern SafeHeapHandle HeapCreate(HeapFlags flOptions, IntPtr dwInitialSize, IntPtr dwMaximumSize);
internal extern static IntPtr CreateHeap(HeapFlags flOptions, uint dwInitialSize, uint dwMaximumSize);
public static extern IntPtr HeapAlloc(SafeHeapHandle hHeap, HeapFlags flags, IntPtr size);
public int Compact(HeapFlags flags) { return Win32.RtlCompactHeap(_heap, flags).ToInt32(); }
public static extern SafeHeapHandle HeapCreate(HeapFlags flOptions, IntPtr dwInitialSize, IntPtr dwMaximumSize);
public int GetBlockSize(HeapFlags flags, IntPtr memory) { return Win32.RtlSizeHeap(_heap, flags, memory).ToInt32(); }
public static extern IntPtr HeapAlloc(IntPtr hHeap, HeapFlags dwFlags, uint dwSize);
internal extern static IntPtr HeapAlloc(IntPtr hHeap, HeapFlags dwFlags, uint dwBytes);
public void Free(HeapFlags flags, IntPtr memory) { Win32.RtlFreeHeap(_heap, flags, memory); }
public static extern IntPtr HeapAlloc(IntPtr hHeap, HeapFlags flags, IntPtr size);
public IntPtr Reallocate(HeapFlags flags, IntPtr memory, int size) { IntPtr newMemory = Win32.RtlReAllocateHeap(_heap, flags, memory, size.ToIntPtr()); if (newMemory == IntPtr.Zero) throw new OutOfMemoryException(); return newMemory; }
private Heap(IntPtr heap) { _heap = heap; _flags = 0; }
public static extern IntPtr HeapAlloc(IntPtr heapHandle, HeapFlags flags, UIntPtr sizeInBytes);
public static extern bool HeapFree(IntPtr heapHandle, HeapFlags flags, IntPtr blockAddress);
/// <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 }
private static extern UIntPtr HeapAlloc(IntPtr heapHandle, [MarshalAs(UnmanagedType.U4)] HeapFlags heapFlags, UIntPtr bytesRequested);