![]() |
F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
|
malloc based memory allocator More...
#include <Fw/Types/MallocAllocator.hpp>
Public Member Functions | |
| MallocAllocator ()=default | |
| virtual | ~MallocAllocator ()=default |
| void * | allocate (const FwEnumStoreType identifier, FwSizeType &size, bool &recoverable, FwSizeType alignment=alignof(std::max_align_t)) override |
| void | deallocate (const FwEnumStoreType identifier, void *ptr) override |
Public Member Functions inherited from Fw::MemAllocator | |
| void * | allocate (const FwEnumStoreType identifier, FwSizeType &size, FwSizeType alignment=alignof(std::max_align_t)) |
| void * | checkedAllocate (const FwEnumStoreType identifier, FwSizeType &size, bool &recoverable, FwSizeType alignment=alignof(std::max_align_t)) |
| void * | checkedAllocate (const FwEnumStoreType identifier, FwSizeType &size, FwSizeType alignment=alignof(std::max_align_t)) |
Additional Inherited Members | |
Protected Member Functions inherited from Fw::MemAllocator | |
| MemAllocator () | |
| virtual | ~MemAllocator () |
malloc based memory allocator
This class implements a memory allocator that uses malloc/free to allocate memory and deallocate memory. malloc() guarantees alignment for any type and thus does this allocator. It will not respect smaller alignments.
Since this directs to heap space, the identifier is unused and memory is never recoverable.
Definition at line 26 of file MallocAllocator.hpp.
|
default |
|
virtualdefault |
|
overridevirtual |
Allocate memory
Allocate memory using malloc(). The identifier is unused and memory is never recoverable. malloc() guarantees alignment for any type and so does this allocator. It will not respect smaller alignments.
| identifier | the memory segment identifier (not used) |
| size | the requested size (not changed) |
| recoverable | - flag to indicate the memory could be recoverable (always set to false) |
| alignment | - alignment requirement for the allocation. Default: maximum alignment defined by C++. |
Implements Fw::MemAllocator.
Definition at line 16 of file MallocAllocator.cpp.
|
overridevirtual |
Deallocate memory
Deallocate memory previously allocated by allocate() using free(). The identifier is unused but should still match the original call.
| identifier | the memory segment identifier (not used) |
| ptr | the pointer to memory returned by allocate() |
Implements Fw::MemAllocator.
Definition at line 31 of file MallocAllocator.cpp.