39 buffer((uint8_t *)buffer)
78 return (
used == other->size()) && (
allocated == other->capacity()) && (buffer.load() == other->buffer.load());
103 return (
used != other->size()) || (
allocated != other->capacity()) || (buffer.load() != other->buffer.load());
131 virtual void rewind(
void);
virtual void * malloc(size_t bytes, size_t alignment=alignment_boundary)
Allocate a small chunk of memory from the internal pool and return a pointer to the caller...
Definition: allocator_memory.cpp:18
std::atomic< size_t > allocated
The number of bytes this object has allocated.
Definition: allocator.h:43
static void unittest(void)
Unit test this class.
Definition: allocator_memory.cpp:77
virtual void rewind(void)
Throw away (without calling delete) all objects allocated in the memory space of this allocator Delet...
Definition: allocator_memory.cpp:68
Virtual base class for C style allocators.
Definition: allocator.h:33
virtual bool operator!=(const allocator &with)
Compare for inequlity two objects of this class type.
Definition: allocator_memory.h:95
std::atomic< size_t > used
The number of bytes this object has passed back to the caller.
Definition: allocator.h:42
virtual bool operator==(const allocator &with)
Compare for equality two objects of this class type.
Definition: allocator_memory.h:70
Base class for different allocators.
virtual ~allocator_memory()
Destructor.
Definition: allocator_memory.h:54
allocator_memory(void *buffer, size_t length)
Constructor.
Definition: allocator_memory.h:38
std::atomic< uint8_t * > buffer
The buffer we're allocating from.
Definition: allocator_memory.h:28
Definition: allocator.h:21
static constexpr size_t alignment_boundary
Elsewhere don't bother with alignment (align on byte boundaries)
Definition: allocator.h:39
Memory allocator out of a single non-growable fixed-sized buffer.
Definition: allocator_memory.h:25