Method MemoryUtil.FreeAlloc
Overload
Frees a memory block (if not null) and allocates new.
public static void FreeAlloc<T>(ref T* mem, nint count, bool zeroInit = false) where T : unmanaged
Parameters
|
mem (T*)
Input: old memory address or |
|
count (nint)
New count of elements of type |
|
zeroInit (bool)
Set all bytes = 0. |
Exceptions
|
OutOfMemoryException
Failed. Probably count is too big. |
Type Parameters
| T |
Remarks
At first sets mem = null, to avoid double MemoryUtil.Free if this function throws exception. Then calls MemoryUtil.Free and MemoryUtil.Alloc.