Interface IAllocator
- Namespace
- SharpPluginLoader.Core.Memory
- Assembly
- SharpPluginLoader.Core.dll
Describes an allocator that can allocate and free unmanaged memory.
public interface IAllocator
Methods
Allocate(nint)
Allocates a block of memory of the specified size.
void* Allocate(nint size)
Parameters
sizenintThe size of the memory block to allocate.
Returns
- void*
A pointer to the allocated memory block.
Allocate<TObj>(int)
Allocates count instances of TObj.
TObj* Allocate<TObj>(int count) where TObj : unmanaged
Parameters
countintThe number of instances to allocate.
Returns
- TObj*
A pointer to the allocated memory block.
Type Parameters
TObjThe type of object to allocate.
Free(void*)
Frees a previously allocated memory block.
void Free(void* ptr)
Parameters
ptrvoid*The pointer to the memory block to free.