Method MemoryUtil.Alloc(+ 1 overload)
Overload
Allocates new memory block and returns its address.
public static byte* Alloc(nint size, bool zeroInit = false)
Parameters
Returns
byte* |
Exceptions
OutOfMemoryException
Failed. Probably size is too big. |
Remarks
Calls API HeapAlloc. The memory is unmanaged and will not be freed automatically. Always call MemoryUtil.Free when done. Call MemoryUtil.ReAlloc<T> or MemoryUtil.FreeAlloc<T> if need to resize.
Overload(top)
Allocates new memory block and returns its address.
public static T* Alloc<T>(nint count, bool zeroInit = false) where T : unmanaged
Parameters
Returns
T* |
Exceptions
OutOfMemoryException
Failed. Probably size is too big. |
Type Parameters
T |
Remarks
Calls API HeapAlloc. The memory is unmanaged and will not be freed automatically. Always call MemoryUtil.Free when done. Call MemoryUtil.ReAlloc<T> or MemoryUtil.FreeAlloc<T> if need to resize.