The AutoAlloc class. This class provides an object-allocation interface for both kernel objects and user-defined types. This class supplies callouts for alloc/free that use object-type metadata to determine how objects may be allocated, allowing a user to create custom dynamic memory implementations for specific object types and sizes. As a result, the user-defined allocators can avoid the kinds of memory fragmentation and exhaustion issues that occur in typical embedded systems in which a single heap is used to satisfy all allocations in the application.
More...
#include <autoalloc.h>
The AutoAlloc class. This class provides an object-allocation interface for both kernel objects and user-defined types. This class supplies callouts for alloc/free that use object-type metadata to determine how objects may be allocated, allowing a user to create custom dynamic memory implementations for specific object types and sizes. As a result, the user-defined allocators can avoid the kinds of memory fragmentation and exhaustion issues that occur in typical embedded systems in which a single heap is used to satisfy all allocations in the application.
Definition at line 72 of file autoalloc.h.
◆ Allocate()
void * Mark3::AutoAlloc::Allocate |
( |
AutoAllocType |
eType_, |
|
|
size_t |
sSize_ |
|
) |
| |
|
staticprivate |
◆ DestroyObject()
template<typename T , AutoAllocType e>
static void Mark3::AutoAlloc::DestroyObject |
( |
T * |
pObj_ | ) |
|
|
inlinestatic |
Template function used to manage the destruction and de-allocation of predefined kernel objects
Definition at line 106 of file autoalloc.h.
◆ DestroyRawData()
void Mark3::AutoAlloc::DestroyRawData |
( |
void * |
pvData_ | ) |
|
|
static |
DestroyRawData Free a previously allocated blob of data allocated via NewRawData()
- Parameters
-
pvData_ | pointer to previously-created data object |
Definition at line 105 of file autoalloc.cpp.
◆ DestroyUserTypeAllocation()
void Mark3::AutoAlloc::DestroyUserTypeAllocation |
( |
uint8_t |
eUserType_, |
|
|
void * |
pvObj_ |
|
) |
| |
|
static |
DestroyUserTypeAllocation Free a previously allocated user-defined object.
- Parameters
-
pvObj_ | Pointer to previously-allocated object, allocated through NewUserTypeAllocation () |
eUserType_ | User defined object type, interpreted by the allocator function |
Definition at line 95 of file autoalloc.cpp.
◆ Free()
void Mark3::AutoAlloc::Free |
( |
AutoAllocType |
eType_, |
|
|
void * |
pvObj_ |
|
) |
| |
|
staticprivate |
◆ Init()
void Mark3::AutoAlloc::Init |
( |
void |
| ) |
|
|
static |
◆ NewObject()
template<typename T , AutoAllocType e>
static T* Mark3::AutoAlloc::NewObject |
( |
| ) |
|
|
inlinestatic |
Template function used to manage the allocation of predefined kernel object types
Definition at line 93 of file autoalloc.h.
◆ NewRawData()
void * Mark3::AutoAlloc::NewRawData |
( |
size_t |
sSize_ | ) |
|
|
static |
NewRawData Attempt to allocate a blob of raw data from the heap.
- Parameters
-
sSize_ | Size of the data blob (in bytes) |
- Returns
- pointer to newly-allocated blob of data, or nullptr on error.
Definition at line 100 of file autoalloc.cpp.
◆ NewUserTypeAllocation()
void * Mark3::AutoAlloc::NewUserTypeAllocation |
( |
uint8_t |
eUserType_ | ) |
|
|
static |
NewUserTypeAllocation Attempt to allocate a user-defined object type from the heap.
- Parameters
-
eUserType_ | User defined object type, interpreted by the allocator function |
- Returns
- pointer to a newly-created object, or nullptr on error.
Definition at line 90 of file autoalloc.cpp.
◆ SetAllocatorFunctions()
SetAllocatorFunctions Set the functions used by this class to allocate/free memory used in the kernel.
- Parameters
-
pfAllocator_ | Function to allocate an object based on its type and/or size |
pfFree_ | Function to free a previously-allocated object |
Definition at line 76 of file autoalloc.cpp.
◆ m_pfAllocator
Function used to allocate objects.
Definition at line 147 of file autoalloc.h.
◆ m_pfFree
Funciton used to free objectss.
Funciton used to free objects.
Definition at line 148 of file autoalloc.h.
The documentation for this class was generated from the following files: