Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::AllocatorANSI Class Reference

ANSI Memory Manager object. More...

Inheritance diagram for Burger::AllocatorANSI:
Collaboration diagram for Burger::AllocatorANSI:

Public Member Functions

const Burger::StaticRTTIget_StaticRTTI (void) const noexcept override
 Get the description to the class.
 
 AllocatorANSI () noexcept=default
 Default constructor.
 
void * allocate_memory (uintptr_t uSize) const noexcept final
 Calls malloc().
 
void free_memory (const void *pInput) const noexcept final
 Calls free().
 
void * reallocate_memory (const void *pInput, uintptr_t uSize) const noexcept final
 Calls realloc().
 
- Public Member Functions inherited from Burger::AllocatorBase
const Burger::StaticRTTIget_StaticRTTI (void) const noexcept override
 Get the description to the class.
 
 AllocatorBase () noexcept=default
 Default constructor.
 
void * allocate_memory_clear (uintptr_t uSize) const noexcept
 Allocate memory that is preinitialized to zero.
 
void * allocate_memory_copy (const void *pInput, uintptr_t uSize) const noexcept
 Allocate a buffer and copy data into it.
 
- Public Member Functions inherited from Burger::Base
const char * get_class_name (void) const noexcept
 Get the name of the class.
 
virtual ~Base () noexcept=default
 Destructor.
 

Static Public Attributes

static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 
- Static Public Attributes inherited from Burger::AllocatorBase
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 
- Static Public Attributes inherited from Burger::Base
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 

Detailed Description

ANSI Memory Manager object.


This class allocates and releases memory using the ANSI malloc(), free() and realloc() calls. No support is present to track memory. If memory tracking is desired either use native memory tracking or use AllocatorHandle instead.

Use this object to instruct functions that allocate memory to use malloc/free as the memory allocation system.

See also
ConsoleApp, MemoryManagerANSI, AllocatorBase, or AllocatorHandle

Constructor & Destructor Documentation

◆ AllocatorANSI()

Burger::AllocatorANSI::AllocatorANSI ( )
defaultnoexcept

Default constructor.


Member Function Documentation

◆ allocate_memory()

void * Burger::AllocatorANSI::allocate_memory ( uintptr_t uSize) const
finalvirtualnoexcept

Calls malloc().


Calls malloc() and returns the pointer allocated. If the requested memory size is zero or the call fails, a nullptr is returned.

Parameters
uSizeNumber of byte requested to allocate.
Returns
nullptr on failure or zero bytes allocated, or a valid memory pointer.
See also
reallocate_memory(const void*, uintptr_t) const, or free_memory(const void*) const

Implements Burger::AllocatorBase.

◆ free_memory()

void Burger::AllocatorANSI::free_memory ( const void * pInput) const
finalvirtualnoexcept

Calls free().


If pInput is nullptr, do nothing. If non-zero, then release the memory back into the free memory pool with a call to free().

Parameters
pInputnullptr will perform no operation or a valid pointer to memory allocated by allocate_memory(uintptr_t) const, or reallocate_memory(const void*, uintptr_t) const.
See also
allocate_memory(uintptr_t) const, or reallocate_memory(const void*, uintptr_t) const

Implements Burger::AllocatorBase.

◆ get_StaticRTTI()

const Burger::StaticRTTI * Burger::AllocatorANSI::get_StaticRTTI ( void ) const
overridevirtualnoexcept

Get the description to the class.


This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.

Returns
Pointer to a global, read only instance of StaticRTTI for the true class

Reimplemented from Burger::Base.

◆ reallocate_memory()

void * Burger::AllocatorANSI::reallocate_memory ( const void * pInput,
uintptr_t uSize ) const
finalvirtualnoexcept

Calls realloc().


Calls realloc() and returns the pointer allocated. If the requested memory size is zero or the call fails, a nullptr is returned. The data in the buffer is retained. If the buffer is extended, the newly allocated space is uninitialized.

If the function fails, the buffer in pInput is untouched, even though the function returned nullptr. However, if the value in uSize is zero, the buffer is freed in all cases with a call to free().

Note
If the requested size is smaller, it's likely that the buffer is truncated and not changed, however this is not guaranteed behavior. If larger, the buffer may be extended, and it too is not guaranteed to be the same pointer value. Assume the input pointer is invalided and the return value is a new pointer to the buffer.
Parameters
pInputPointer to a valid buffer to resize.
uSizeNumber of byte requested to for the new buffer size.
Returns
nullptr on failure or zero bytes allocated, or a valid memory pointer.
See also
allocate_memory(uintptr_t) const, or free_memory(const void*) const

Implements Burger::AllocatorBase.

Member Data Documentation

◆ g_StaticRTTI

const Burger::StaticRTTI Burger::AllocatorANSI::g_StaticRTTI
static

The global description of the class.


This record contains the name of this class and a reference to the parent