cohtml::IAllocator
Allocator interface used by Cohtml for all memory allocations. The user has to provide an object that implements this interface. Memory allocations in Cohtml are tagged, so the user knows the relative distribution of memory among subsystems.
#include <Library.h>
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| IAllocator() | |
| virtual void * | Allocate(unsigned size, cohtml::MemTags::MemTagsType memtag) =0 Allocate size bytes. |
| virtual void * | Reallocate(void * ptr, unsigned size, cohtml::MemTags::MemTagsType memtag) =0 Reallocates the given area of memory. It must be previously allocated by Allocate. |
| virtual void | Deallocate(void * ptr, cohtml::MemTags::MemTagsType memtag) =0 Deallocates the memory previously allocated by Allocate. |
| virtual void * | AlignedAllocate(unsigned size, unsigned alignment, cohtml::MemTags::MemTagsType memtag) =0 Allocate size bytes whose alignment is specified by alignment. |
| virtual void | AlignedDeallocate(void * ptr, cohtml::MemTags::MemTagsType memtag) =0 Deallocates the memory previously allocated by AlignedAllocate. |
| virtual | ~IAllocator() |
Public Functions Documentation
Section titled “Public Functions Documentation”function IAllocator
Section titled “function IAllocator”IAllocator()function Allocate
Section titled “function Allocate”virtual void * Allocate( unsigned size, cohtml::MemTags::MemTagsType memtag) =0Allocate size bytes.
Parameters:
- size the number of bytes to allocate
- memtag tag of the subsystem from which the request came
Return: the pointer to the beginning of newly allocated memory.
Warning: the memory must be aligned on 8
function Reallocate
Section titled “function Reallocate”virtual void * Reallocate( void * ptr, unsigned size, cohtml::MemTags::MemTagsType memtag) =0Reallocates the given area of memory. It must be previously allocated by Allocate.
Parameters:
- ptr the pointer to the memory area to be reallocated
- size number of bytes to allocate
- memtag tag of the subsystem from which the request came
function Deallocate
Section titled “function Deallocate”virtual void Deallocate( void * ptr, cohtml::MemTags::MemTagsType memtag) =0Deallocates the memory previously allocated by Allocate.
Parameters:
- ptr the pointer to the memory to deallocate
- memtag tag of the subsystem from which the request came
function AlignedAllocate
Section titled “function AlignedAllocate”virtual void * AlignedAllocate( unsigned size, unsigned alignment, cohtml::MemTags::MemTagsType memtag) =0Allocate size bytes whose alignment is specified by alignment.
Parameters:
- size number of bytes to allocate
- alignment specifies the alignment
- memtag tag of the subsystem from which the request came
Return: the pointer to the beginning of newly allocated memory
Warning: when specified, memory alignment for allocations should be preserved
function AlignedDeallocate
Section titled “function AlignedDeallocate”virtual void AlignedDeallocate( void * ptr, cohtml::MemTags::MemTagsType memtag) =0Deallocates the memory previously allocated by AlignedAllocate.
Parameters:
- ptr the pointer to the memory to deallocate
- memtag tag of the subsystem from which the request came
function ~IAllocator
Section titled “function ~IAllocator”virtual ~IAllocator()© 2026 Coherent Labs. All rights reserved.