Mega Code Archive

 
Categories / C# Tutorial / Windows
 

Create Heap and destroy Heap

using System; using System.Runtime.InteropServices; public sealed class MainClass {     [DllImport("kernel32.dll")]     static extern IntPtr HeapCreate(uint flOptions, UIntPtr dwInitialSize,UIntPtr dwMaximumSize);     [DllImport("kernel32.dll")]     static extern bool HeapDestroy(IntPtr hHeap);     public static void Main() {         IntPtr theHeap = HeapCreate( 0, (UIntPtr) 4096, UIntPtr.Zero );         HeapDestroy( theHeap );         theHeap = IntPtr.Zero;     } }