using System;
using System.Runtime.InteropServices;
public unsafe class Memory
{
// Heap API flags
const int HEAP_ZERO_MEMORY = 0x00000008;
static int ph = GetProcessHeap();
public static void* Alloc(int size)
{
void* result = HeapAlloc(ph, HEAP_ZERO_MEMORY, size);
if (result == null)
throw new OutOfMemoryException();
return result;
}
}
|