9 #ifndef CPPCOMMON_MEMORY_ALLOCATOR_STACK_H
10 #define CPPCOMMON_MEMORY_ALLOCATOR_STACK_H
44 size_t allocated() const noexcept {
return _allocated; }
49 const uint8_t*
buffer() const noexcept {
return _buffer; }
51 size_t capacity() const noexcept {
return _capacity; }
53 size_t size() const noexcept {
return _size; }
56 size_t max_size() const noexcept {
return _capacity; }
64 void*
malloc(
size_t size,
size_t alignment =
alignof(std::max_align_t));
86 template <
typename T,
size_t N,
bool nothrow = false>
Memory allocator definition.
Stack memory allocator inline implementation.
Stack memory manager class.
void free(void *ptr, size_t size)
Free the previously allocated memory block.
const uint8_t * buffer() const noexcept
Stack buffer.
void * malloc(size_t size, size_t alignment=alignof(std::max_align_t))
Allocate a new memory block of the given size.
size_t max_size() const noexcept
Maximum memory block size, that could be allocated by the memory manager.
size_t allocations() const noexcept
Count of active memory allocations.
StackMemoryManager(const StackMemoryManager &)=delete
size_t size() const noexcept
Stack allocated size.
StackMemoryManager & operator=(const StackMemoryManager &)=delete
~StackMemoryManager() noexcept
void reset()
Reset the memory manager.
StackMemoryManager & operator=(StackMemoryManager &&)=delete
size_t capacity() const noexcept
Stack capacity.
StackMemoryManager(StackMemoryManager &&)=delete
size_t allocated() const noexcept
Allocated memory in bytes.
C++ Common project definitions.