omni::structuredlog::Allocator
Defined in omni/structuredlog/JsonTree.h
-
class Allocator
A memory allocator interface, which can be overwritten with your custom allocator.
Subclassed by omni::structuredlog::BlockAllocator
Public Functions
-
inline virtual ~Allocator()
-
inline virtual void *alloc(size_t size)
Allocated memory.
Remark
This should be overwritten by custom memory allocators to use another allocation mechanism.
- Parameters
size – [in] The number of bytes to allocate.
- Returns
The allocated memory.
- Returns
nullptr if memory was not available.
-
inline virtual void dealloc(void *mem)
Deallocate a previously allocated block.
- Parameters
mem – [in] A block previously allocated by alloc().
Public Static Functions
-
static inline size_t fixupAlignment(size_t size)
Round a size up to be aligned to kAlignment.
- Parameters
size – [in] The size to align.
- Returns
size
rounded up to the next multiple of kAlignment.
Public Static Attributes
-
static constexpr size_t kAlignment = alignof(void*)
The alignment that each allocation must be.
-
inline virtual ~Allocator()