Class Allocation
Provides functions for memory allocation on the unmanaged heap.
[ExcludeFromCodeCoverage]
public static class Allocation
- Inheritance
-
Allocation
- Inherited Members
Methods
Allocate(int)
Allocates a block of bytes from the unmanaged heap.
public static void* Allocate(int bytes)
Parameters
bytesintThe number of bytes to allocate.
Returns
AllocateClear(int)
Allocates a block of bytes from the unmanaged heap, and zeroes it.
public static void* AllocateClear(int bytes)
Parameters
bytesintThe number of bytes to allocate.
Returns
AllocateClear<T>(int)
Allocates a block of elements of a specified type
T from the unmanaged heap, and zeroes it.
public static T* AllocateClear<T>(int elements) where T : unmanaged
Parameters
elementsintThe number of elements the allocated block will store.
Returns
- T*
A
T* pointing to the start of the allocated block. The block's size is equal to the number of elements multiplied by sizeof(T).
Type Parameters
TThe type of elements the allocated block will store.
Allocate<T>(int)
Allocates a block of elements of a specified type
T from the unmanaged heap.
public static T* Allocate<T>(int elements) where T : unmanaged
Parameters
elementsintThe number of elements the allocated block will store.
Returns
- T*
A
T* pointing to the start of the allocated block. The block's size is equal to the number of elements multiplied by sizeof(T).
Type Parameters
TThe type of elements the allocated block will store.
Free(void*)
Frees a previously allocated block of bytes from the unmanaged heap.
public static void Free(void* pointer)
Parameters
Reallocate(void*, int)
Reallocates a block of bytes from the unmanaged heap.
public static void* Reallocate(void* pointer, int bytes)
Parameters
pointervoid*The pointer to the original block that will be reallocated.
bytesintThe number of bytes of the newly allocated block.
Returns
Reallocate<T>(T*, int)
Reallocates a block of elements from the unmanaged heap.
public static T* Reallocate<T>(T* pointer, int elements) where T : unmanaged
Parameters
pointerT*The pointer to the original block that will be reallocated.
elementsintThe number of elements of the newly allocated block.
Returns
- T*
A
T* pointing to the start of the reallocated block. The block's size is equal to the number of elements multiplied by sizeof(T).
Type Parameters
T