F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
MallocAllocator.cpp
Go to the documentation of this file.
1
13
#include <
Fw/Types/MallocAllocator.hpp
>
14
#include <cstdlib>
15
16
namespace
Fw
{
17
18
MallocAllocator::MallocAllocator
() {}
19
20
MallocAllocator::~MallocAllocator
() {}
21
22
void
*
MallocAllocator::allocate
(
const
FwEnumStoreType
identifier,
FwSizeType
& size,
bool
& recoverable) {
23
// don't use identifier
24
// heap memory is never recoverable
25
recoverable =
false
;
26
void
* mem = ::malloc(static_cast<size_t>(size));
27
if
(
nullptr
== mem) {
28
size = 0;
// set to zero if can't get memory
29
}
30
return
mem;
31
}
32
33
void
MallocAllocator::deallocate
(
const
FwEnumStoreType
identifier,
void
* ptr) {
34
::free(ptr);
35
}
36
37
}
/* namespace Fw */
FwSizeType
PlatformSizeType FwSizeType
Definition:
FwSizeTypeAliasAc.h:15
FwEnumStoreType
I32 FwEnumStoreType
Definition:
FwEnumStoreTypeAliasAc.h:14
Fw::MallocAllocator::MallocAllocator
MallocAllocator()
Definition:
MallocAllocator.cpp:18
MallocAllocator.hpp
A MemAllocator implementation class that uses malloc.
Fw::MallocAllocator::allocate
void * allocate(const FwEnumStoreType identifier, FwSizeType &size, bool &recoverable)
Allocate memory.
Definition:
MallocAllocator.cpp:22
Fw::MallocAllocator::~MallocAllocator
virtual ~MallocAllocator()
Definition:
MallocAllocator.cpp:20
Fw
Definition:
FppConstantsAc.hpp:121
Fw::MallocAllocator::deallocate
void deallocate(const FwEnumStoreType identifier, void *ptr)
Deallocate memory.
Definition:
MallocAllocator.cpp:33
Fw
Types
MallocAllocator.cpp
Generated by
1.8.14