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::MemoryManagerANSI Class Reference

ANSI Memory Manager. More...

Inheritance diagram for Burger::MemoryManagerANSI:
Collaboration diagram for Burger::MemoryManagerANSI:

Public Member Functions

 MemoryManagerANSI () noexcept
 Constructor for the ANSI memory allocator.
 
void * alloc (uintptr_t uSize) noexcept
 Allocates memory.
 
void free (const void *pInput) noexcept
 Frees memory.
 
void * realloc (const void *pInput, uintptr_t uSize) noexcept
 Reallocates memory.
 
- Public Member Functions inherited from Burger::MemoryManager
void * alloc (uintptr_t uSize) noexcept
 Allocate memory.
 
void free (const void *pInput) noexcept
 Release memory.
 
void * realloc (const void *pInput, uintptr_t uSize) noexcept
 Reallocate memory.
 
void shutdown (void) noexcept
 Shut down the memory manager.
 
void * alloc_clear (uintptr_t uSize) noexcept
 Allocate a block of pre-zeroed memory.
 

Static Protected Member Functions

static void * alloc (MemoryManager *pThis, uintptr_t uSize) noexcept
 Calls malloc().
 
static void free (MemoryManager *pThis, const void *pInput) noexcept
 Calls free().
 
static void * realloc (MemoryManager *pThis, const void *pInput, uintptr_t uSize) noexcept
 Calls realloc().
 

Private Member Functions

 MemoryManagerANSI (const MemoryManagerANSI &)=delete
 
MemoryManagerANSIoperator= (const MemoryManagerANSI &)=delete
 
 MemoryManagerANSI (MemoryManagerANSI &&)=delete
 
MemoryManagerANSIoperator= (MemoryManagerANSI &&)=delete
 

Additional Inherited Members

- Public Types inherited from Burger::MemoryManager
typedef void *(*) ProcAlloc(MemoryManager *pThis, uintptr_t uSize)
 Function prototype for allocating memory.
 
typedef void(*) ProcFree(MemoryManager *pThis, const void *pInput)
 Function prototype for releasing memory.
 
typedef void *(*) ProcRealloc(MemoryManager *pThis, const void *pInput, uintptr_t uSize)
 Function prototype for reallocating memory.
 
typedef void(*) ProcShutdown(MemoryManager *pThis)
 Function prototype for destructor.
 
- Static Public Member Functions inherited from Burger::MemoryManager
static void shutdown (MemoryManager *pThis) noexcept
 Default memory manager destructor.
 
- Public Attributes inherited from Burger::MemoryManager
ProcAlloc m_pAlloc
 Pointer to allocation function.
 
ProcFree m_pFree
 Pointer to memory release function.
 
ProcRealloc m_pRealloc
 Pointer to the memory reallocation function.
 
ProcShutdown m_pShutdown
 Pointer to the shutdown function.
 

Detailed Description

ANSI Memory Manager.


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

Constructor & Destructor Documentation

◆ MemoryManagerANSI() [1/3]

Burger::MemoryManagerANSI::MemoryManagerANSI ( const MemoryManagerANSI & )
privatedelete

◆ MemoryManagerANSI() [2/3]

Burger::MemoryManagerANSI::MemoryManagerANSI ( MemoryManagerANSI && )
privatedelete

◆ MemoryManagerANSI() [3/3]

Burger::MemoryManagerANSI::MemoryManagerANSI ( )
noexcept

Constructor for the ANSI memory allocator.


Initializes the jump table in the base class MemoryManager

Member Function Documentation

◆ alloc() [1/2]

void *BURGER_API Burger::MemoryManagerANSI::alloc ( MemoryManager * pThis,
uintptr_t uSize )
staticprotectednoexcept

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
pThisPointer to the current instance.
uSizeNumber of byte requested to allocate.
Returns
nullptr on failure or zero bytes allocated, or a valid memory pointer.
See also
alloc(uintptr_t)

◆ alloc() [2/2]

void * Burger::MemoryManagerANSI::alloc ( uintptr_t uSize)
inlinenoexcept

Allocates memory.


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
alloc(MemoryManager *,uintptr_t)

◆ free() [1/2]

void Burger::MemoryManagerANSI::free ( const void * pInput)
inlinenoexcept

Frees memory.


If pInput is nullptr, do nothing. If non-zero, then release the memory back into the free memory pool.

Parameters
pInputnullptr to do no operation or a valid pointer to memory allocated by alloc(uintptr_t) or realloc(const void*, uintptr_t).
See also
free(MemoryManager *,const void *)

◆ free() [2/2]

void BURGER_API Burger::MemoryManagerANSI::free ( MemoryManager * pThis,
const void * pInput )
staticprotectednoexcept

Calls free().


If pInput is nullptr, do nothing. If non-zero, then release the memory back into the free memory pool.

Parameters
pThisPointer to the current instance.
pInputnullptr to do no operation or a valid pointer to memory allocated by alloc(MemoryManager*,uintptr_t) or realloc(MemoryManager*,const void *,uintptr_t).
See also
free(const void *)

◆ operator=() [1/2]

MemoryManagerANSI & Burger::MemoryManagerANSI::operator= ( const MemoryManagerANSI & )
privatedelete

◆ operator=() [2/2]

MemoryManagerANSI & Burger::MemoryManagerANSI::operator= ( MemoryManagerANSI && )
privatedelete

◆ realloc() [1/2]

void * Burger::MemoryManagerANSI::realloc ( const void * pInput,
uintptr_t uSize )
inlinenoexcept

Reallocates memory.


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

Note
If the requested size is smaller, it's likely that the buffer is truncated and not changed, however this in 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 from here on out and the return value is the new pointer to the buffer.
Parameters
pInputPointer to a valid buffer to resize.
uSizeNumber of byte requested to allocate.
Returns
nullptr on failure or zero bytes allocated, or a valid memory pointer.
See also
realloc(MemoryManager *,const void *,uintptr_t)

◆ realloc() [2/2]

void *BURGER_API Burger::MemoryManagerANSI::realloc ( MemoryManager * pThis,
const void * pInput,
uintptr_t uSize )
staticprotectednoexcept

Calls realloc().


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

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