CppCommon  1.0.4.1
C++ Common Library
Public Member Functions | List of all members
CppCommon::HeapMemoryManager Class Reference

Heap memory manager class. More...

#include <allocator_heap.h>

Public Member Functions

 HeapMemoryManager () noexcept
 
 HeapMemoryManager (const HeapMemoryManager &)=delete
 
 HeapMemoryManager (HeapMemoryManager &&)=delete
 
 ~HeapMemoryManager () noexcept
 
HeapMemoryManageroperator= (const HeapMemoryManager &)=delete
 
HeapMemoryManageroperator= (HeapMemoryManager &&)=delete
 
size_t allocated () const noexcept
 Allocated memory in bytes. More...
 
size_t allocations () const noexcept
 Count of active memory allocations. More...
 
size_t max_size () const noexcept
 Maximum memory block size, that could be allocated by the memory manager. More...
 
void * malloc (size_t size, size_t alignment=alignof(std::max_align_t))
 Allocate a new memory block of the given size. More...
 
void free (void *ptr, size_t size)
 Free the previously allocated memory block. More...
 
void reset ()
 Reset the memory manager. More...
 

Detailed Description

Heap memory manager class.

Heap memory manager will allocate memory in system heap. Windows: HeapAlloc()/HeapFree() Unix: malloc()/free()

Not thread-safe.

Definition at line 34 of file allocator_heap.h.

Constructor & Destructor Documentation

◆ HeapMemoryManager() [1/3]

CppCommon::HeapMemoryManager::HeapMemoryManager ( )
inlinenoexcept

Definition at line 37 of file allocator_heap.h.

◆ HeapMemoryManager() [2/3]

CppCommon::HeapMemoryManager::HeapMemoryManager ( const HeapMemoryManager )
delete

◆ HeapMemoryManager() [3/3]

CppCommon::HeapMemoryManager::HeapMemoryManager ( HeapMemoryManager &&  )
delete

◆ ~HeapMemoryManager()

CppCommon::HeapMemoryManager::~HeapMemoryManager ( )
inlinenoexcept

Definition at line 40 of file allocator_heap.h.

Member Function Documentation

◆ allocated()

size_t CppCommon::HeapMemoryManager::allocated ( ) const
inlinenoexcept

Allocated memory in bytes.

Definition at line 46 of file allocator_heap.h.

◆ allocations()

size_t CppCommon::HeapMemoryManager::allocations ( ) const
inlinenoexcept

Count of active memory allocations.

Definition at line 48 of file allocator_heap.h.

◆ free()

void CppCommon::HeapMemoryManager::free ( void *  ptr,
size_t  size 
)
inline

Free the previously allocated memory block.

Parameters
ptr- Pointer to the memory block
size- Block size

Definition at line 30 of file allocator_heap.inl.

◆ malloc()

void * CppCommon::HeapMemoryManager::malloc ( size_t  size,
size_t  alignment = alignof(std::max_align_t) 
)
inline

Allocate a new memory block of the given size.

Parameters
size- Block size
alignment- Block alignment (default is alignof(std::max_align_t))
Returns
A pointer to the allocated memory block or nullptr in case of allocation failed

Definition at line 11 of file allocator_heap.inl.

◆ max_size()

size_t CppCommon::HeapMemoryManager::max_size ( ) const
inlinenoexcept

Maximum memory block size, that could be allocated by the memory manager.

Definition at line 51 of file allocator_heap.h.

◆ operator=() [1/2]

HeapMemoryManager& CppCommon::HeapMemoryManager::operator= ( const HeapMemoryManager )
delete

◆ operator=() [2/2]

HeapMemoryManager& CppCommon::HeapMemoryManager::operator= ( HeapMemoryManager &&  )
delete

◆ reset()

void CppCommon::HeapMemoryManager::reset ( )
inline

Reset the memory manager.

Definition at line 48 of file allocator_heap.inl.


The documentation for this class was generated from the following files: