public override void *Reallocate(void *pointer, int elementCount, int elementSize = 1, bool initMemory = true) { if (elementCount <= 0) { throw new ArgumentException(elementCount.ToString(), nameof(elementCount)); } if (elementSize <= 0) { throw new ArgumentException(elementSize.ToString(), nameof(elementSize)); } HeapMemoryFlags flags = initMemory ? HeapMemoryFlags.HEAP_ZERO_MEMORY : HeapMemoryFlags.NONE; void * memory = Kernel32HeapMemory.HeapReAlloc(_HeapPointer, flags, pointer, (uint)(elementCount * elementSize)); if (memory == null) { throw new OutOfMemoryException(); } return(memory); }
public static extern void *HeapAlloc(void *heap, HeapMemoryFlags flags, uint totalBytes);
public static extern uint HeapCreate(HeapMemoryFlags flags, uint initialSize, uint maxSize);
public static extern void *HeapCompact(void *heap, HeapMemoryFlags flags);
public static extern uint HeapSize(void *heap, HeapMemoryFlags flags, void *pointer);
public static extern bool HeapFree(void *heap, HeapMemoryFlags flags, void *pointer);