9 #ifndef CPPCOMMON_MEMORY_ALLOCATOR_NULL_H
10 #define CPPCOMMON_MEMORY_ALLOCATOR_NULL_H
35 size_t allocated() const noexcept {
return _allocated; }
40 size_t max_size() const noexcept {
return std::numeric_limits<size_t>::max(); }
48 void*
malloc(
size_t size,
size_t alignment =
alignof(std::max_align_t));
54 void free(
void* ptr,
size_t size);
66 template <
typename T,
bool nothrow = false>
Memory allocator definition.
Null memory allocator inline implementation.
Null memory manager class.
void reset()
Reset the memory manager.
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.
void free(void *ptr, size_t size)
Free the previously allocated memory block.
~NullMemoryManager() noexcept
NullMemoryManager & operator=(NullMemoryManager &&)=delete
NullMemoryManager(NullMemoryManager &&)=delete
NullMemoryManager() noexcept
NullMemoryManager & operator=(const NullMemoryManager &)=delete
NullMemoryManager(const NullMemoryManager &)=delete
size_t allocated() const noexcept
Allocated memory in bytes.
void * malloc(size_t size, size_t alignment=alignof(std::max_align_t))
Allocate a new memory block of the given size.
C++ Common project definitions.