using System.Runtime.InteropServices;
namespace UnmanagedMMU.Allocators
{
///
/// Interface that defines an Unmanaged allocator
///
public unsafe interface IUnmanagedAllocator
{
///
/// Allocates an unmanaged memory block of the specified size.
///
/// The number of bytes to allocate.
///
/// A pointer to the beginning of the allocated memory block,.
///
void* Alloc(nuint size);
///
/// Allocates an unmanaged memory block of the specified size with the requested alignment
///
/// The number of bytes to allocate.
/// The alignment, in bytes, of the block to allocate. This must be a power of 2
///
void* AllocAligned(nuint size, nuint alignment);
///
/// Frees a previously allocated unmanaged memory block.
///
/// A pointer to the beginning of the memory block to free.
/// This method should only be called on with pointers allocated with .
void Free(void* ptr);
///
/// Frees a previously allocated unmanaged aligned memory block
///
/// A pointer to the beginning of the memory block to free.
/// The alignment that the memory refered to by was aligned at (This parameter can be ignored if the underlying allocator does not need it)
/// This method should only be called on with pointers allocated with .
void FreeAligned(void* ptr, nuint alignment = 0);
}
}