Example #1
0
        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();
        }
Example #2
0
        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();
        }
Example #3
0
 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);
Example #5
0
 public static extern IntPtr HeapReAlloc(IntPtr heapHandle, HeapFlags flags, IntPtr blockAddress,
     UIntPtr sizeInBytes);
Example #6
0
 public Heap(HeapFlags flags)
     : this(flags, 0, 0)
 { }
Example #7
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);
Example #9
0
 internal extern static IntPtr HeapFree(IntPtr hHeap, HeapFlags dwFlags, IntPtr lpMem);
Example #10
0
 public Heap(HeapFlags flags)
     : this(flags, 0, 0)
 {
 }
Example #11
0
 public static extern IntPtr HeapCreate(HeapFlags flOptions, uint dwInitialsize, uint dwMaximumSize);
Example #12
0
 public static extern bool HeapFree(IntPtr hHeap, HeapFlags flags, IntPtr block);
Example #13
0
 private Heap(IntPtr heap)
 {
     _heap  = heap;
     _flags = 0;
 }
Example #14
0
 public static extern IntPtr HeapAlloc(IntPtr hHeap, HeapFlags flags, IntPtr size);
Example #15
0
 public static extern SafeHeapHandle HeapCreate(HeapFlags flOptions, IntPtr dwInitialSize, IntPtr dwMaximumSize);
Example #16
0
 internal extern static IntPtr CreateHeap(HeapFlags flOptions, uint dwInitialSize, uint dwMaximumSize);
Example #17
0
 public static extern IntPtr HeapAlloc(SafeHeapHandle hHeap, HeapFlags flags, IntPtr size);
Example #18
0
 public int Compact(HeapFlags flags)
 {
     return Win32.RtlCompactHeap(_heap, flags).ToInt32();
 }
Example #19
0
 public static extern SafeHeapHandle HeapCreate(HeapFlags flOptions, IntPtr dwInitialSize, IntPtr dwMaximumSize);
Example #20
0
 public int GetBlockSize(HeapFlags flags, IntPtr memory)
 {
     return Win32.RtlSizeHeap(_heap, flags, memory).ToInt32();
 }
Example #21
0
 public static extern IntPtr HeapAlloc(IntPtr hHeap, HeapFlags dwFlags, uint dwSize);
Example #22
0
 internal extern static IntPtr HeapAlloc(IntPtr hHeap, HeapFlags dwFlags, uint dwBytes);
Example #23
0
 public void Free(HeapFlags flags, IntPtr memory)
 {
     Win32.RtlFreeHeap(_heap, flags, memory);
 }
Example #24
0
 public static extern IntPtr HeapAlloc(IntPtr hHeap, HeapFlags flags, IntPtr size);
Example #25
0
        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;
        }
Example #26
0
 private Heap(IntPtr heap)
 {
     _heap = heap;
     _flags = 0;
 }
Example #27
0
 public static extern IntPtr HeapAlloc(IntPtr heapHandle, HeapFlags flags, UIntPtr sizeInBytes);
Example #28
0
 public static extern bool HeapFree(IntPtr heapHandle, HeapFlags flags, IntPtr blockAddress);
Example #29
0
        /// <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
        }
Example #30
0
 private static extern UIntPtr HeapAlloc(IntPtr heapHandle, [MarshalAs(UnmanagedType.U4)] HeapFlags heapFlags, UIntPtr bytesRequested);