µOS++ IIIe Reference  v6.3.15
“Perfekt ist nicht gut genug”
The third edition of µOS++, a POSIX inspired open source system, written in C++.
Memory management

C++ API memory management definitions. More...

Namespaces

 std
 Standard std namespace.
 

Classes

class  os::rtos::memory::allocator_deleter< A >
 Allocator deleter. More...
 
class  os::rtos::memory::allocator_stateless_default_resource< T >
 Standard allocator based on the RTOS system default memory manager. More...
 
class  os::rtos::memory::allocator_stateless_polymorphic_synchronized< T, L, get_resource >
 Allocator using memory resources. More...
 
class  os::memory::block_pool
 Memory resource managing a pool of same size blocks, using an existing arena. More...
 
class  os::memory::block_pool_typed_allocated< T, A >
 Memory resource managing a dynamically allocated pool. of same size blocks of type T. More...
 
class  os::memory::block_pool_typed_inclusive< T, N >
 Memory resource managing an internal pool. of same size blocks of type T. More...
 
class  os::memory::first_fit_top
 Memory resource implementing the first fit, top-down allocation policies, using an existing arena. More...
 
class  os::memory::first_fit_top_allocated< A >
 Memory resource implementing the first fit, top-down allocation policies, using a dynamically allocated arena. More...
 
class  os::memory::first_fit_top_inclusive< N >
 Memory resource implementing the first fit, top-down allocation policies, using an internal arena. More...
 
class  os::memory::lifo
 Memory resource implementing the LIFO allocation/deallocation policies, using an existing arena. More...
 
class  os::memory::lifo_allocated< A >
 Memory resource implementing the LIFO allocation policies, using a dynamically allocated arena. More...
 
class  os::memory::lifo_inclusive< N >
 Memory resource implementing the LIFO allocation policies, using an internal arena. More...
 
class  os::memory::malloc_memory_resource
 A memory manager that allocates memory via the system std::malloc() and deallocates via std::free(). More...
 
class  os::rtos::memory::memory_resource
 Memory resource manager (abstract class). More...
 
class  os::memory::new_delete_memory_resource
 A memory manager that allocates memory via the system operator new and deallocates via operator delete. More...
 
class  os::memory::null_memory_resource
 An internal memory manager that throws a bad_alloc() exception when trying to allocate. More...
 

Types

template<typename T >
using os::rtos::memory::allocator = allocator_stateless_default_resource< T >
 Type of allocator used by the system objects. Must be stateless. More...
 
template<typename T , typename U = T>
using os::rtos::memory::allocator_typed = allocator_stateless_polymorphic_synchronized< T, scheduler::lockable, get_resource_typed< U > >
 Type of an allocator for objects of type T. More...
 
using os::rtos::memory::out_of_memory_handler_t = void(*)(void)
 Type of out of memory handler. More...
 
template<typename T , typename U = T>
using os::rtos::memory::unique_ptr = std::unique_ptr< T, allocator_deleter< allocator_typed< T, U > >>
 Type of a RTOS unique pointer to objects of type T. More...
 

Functions

template<typename T , typename A , typename ... Args>
auto os::rtos::memory::allocate_unique (const A &allocator, Args &&... args)
 Function template to allocate a unique pointer. More...
 
template<typename T , typename ... Args>
std::enable_if<!std::is_array< T >::value, std::shared_ptr< T > >::type os::rtos::make_shared (Args &&... args)
 Create an object that is owned by a shared_ptr and is allocated using the RTOS system allocator. More...
 
template<typename T1 , typename T2 , typename L , F get_resource>
bool os::rtos::memory::operator!= (const allocator_stateless_polymorphic_synchronized< T1, L, get_resource > &lhs, const allocator_stateless_polymorphic_synchronized< T2, L, get_resource > &rhs) noexcept
 
template<typename T1 , typename T2 , typename L , F get_resource>
bool os::rtos::memory::operator== (const allocator_stateless_polymorphic_synchronized< T1, L, get_resource > &lhs, const allocator_stateless_polymorphic_synchronized< T2, L, get_resource > &rhs) noexcept
 

RTOS System Memory Functions

memory_resourceos::rtos::memory::malloc_resource (void) noexcept
 Get the address of a memory manager based on POSIX malloc(). More...
 
memory_resourceos::rtos::memory::set_default_resource (memory_resource *res) noexcept
 Set the default RTOS system memory manager. More...
 
memory_resourceos::rtos::memory::get_default_resource (void) noexcept
 Get the default RTOS system memory manager. More...
 
void os::rtos::memory::init_once_default_resource (void)
 

Operators

bool os::rtos::memory::operator== (const memory_resource &lhs, const memory_resource &rhs) noexcept
 Compare the memory_resource instances for equality. More...
 
bool os::rtos::memory::operator!= (const memory_resource &lhs, const memory_resource &rhs) noexcept
 Compare the memory_resource instances for inequality. More...
 

Type Specific Resource Managers

template<typename T >
memory_resourceos::rtos::memory::set_resource_typed (memory_resource *res) noexcept
 Function template to set a memory resource. More...
 
template<typename T >
memory_resourceos::rtos::memory::get_resource_typed (void) noexcept
 Function template to get a memory resource. More...
 
template<>
memory_resourceos::rtos::memory::set_resource_typed< thread > (memory_resource *res) noexcept
 
template<>
memory_resourceos::rtos::memory::get_resource_typed< thread > (void) noexcept
 
template<>
memory_resourceos::rtos::memory::set_resource_typed< condition_variable > (memory_resource *res) noexcept
 
template<>
memory_resourceos::rtos::memory::get_resource_typed< condition_variable > (void) noexcept
 
template<>
memory_resourceos::rtos::memory::set_resource_typed< event_flags > (memory_resource *res) noexcept
 
template<>
memory_resourceos::rtos::memory::get_resource_typed< event_flags > (void) noexcept
 
template<>
memory_resourceos::rtos::memory::set_resource_typed< memory_pool > (memory_resource *res) noexcept
 
template<>
memory_resourceos::rtos::memory::get_resource_typed< memory_pool > (void) noexcept
 
template<>
memory_resourceos::rtos::memory::set_resource_typed< message_queue > (memory_resource *res) noexcept
 
template<>
memory_resourceos::rtos::memory::get_resource_typed< message_queue > (void) noexcept
 
template<>
memory_resourceos::rtos::memory::set_resource_typed< mutex > (memory_resource *res) noexcept
 
template<>
memory_resourceos::rtos::memory::get_resource_typed< mutex > (void) noexcept
 
template<>
memory_resourceos::rtos::memory::set_resource_typed< semaphore > (memory_resource *res) noexcept
 
template<>
memory_resourceos::rtos::memory::get_resource_typed< semaphore > (void) noexcept
 
template<>
memory_resourceos::rtos::memory::set_resource_typed< timer > (memory_resource *res) noexcept
 
template<>
memory_resourceos::rtos::memory::get_resource_typed< timer > (void) noexcept
 

Standard operators

void * operator new (std::size_t bytes)
 Allocate space for a new object instance. More...
 
void * operator new (std::size_t bytes, const std::nothrow_t &nothrow) noexcept
 Allocate space for a new object instance (nothrow). More...
 
void * operator new[] (std::size_t bytes)
 Allocate space for an array of new object instances. More...
 
void * operator new[] (std::size_t bytes, const std::nothrow_t &nothrow) noexcept
 Allocate space for an array of new object instances (nothrow). More...
 
void operator delete (void *ptr) noexcept
 Deallocate the dynamically allocated object instance. More...
 
void operator delete (void *ptr, std::size_t bytes) noexcept
 Deallocate the dynamically allocated object instance. More...
 
void operator delete (void *ptr, const std::nothrow_t &nothrow) noexcept
 Deallocate the dynamically allocated object instance (nothrow). More...
 
void operator delete[] (void *ptr) noexcept
 Deallocate the dynamically allocated array of object. More...
 
void operator delete[] (void *ptr, std::size_t bytes) noexcept
 Deallocate the dynamically allocated array of object. More...
 
void operator delete[] (void *ptr, const std::nothrow_t &nothrow) noexcept
 Deallocate the dynamically allocated array of object (nothrow). More...
 

Standard Memory Functions

memory_resourceos::estd::pmr::new_delete_resource (void) noexcept
 Get the address of a memory manager based on new/delete. More...
 
memory_resourceos::estd::pmr::null_memory_resource (void) noexcept
 Get the address of an ineffective memory manager. More...
 
memory_resourceos::estd::pmr::set_default_resource (memory_resource *res) noexcept
 Set the default application memory manager. More...
 
memory_resourceos::estd::pmr::get_default_resource (void) noexcept
 Get the default application memory manager. More...
 

Detailed Description

C++ API memory management definitions.

The µOS++ RTOS includes several advanced and flexible memory management features.

First, it defines a configurable memory manager for the application free store (also known as the "heap").

Second, it defines a separate memory manager to be used by the RTOS system objects. This separate manager can be configured to use any allocation policy. It may use either a statically or a dynamically allocated area.

The reason for the system memory manager is to allow RTOS system objects to be separated from application objects; this has several advantages:

Third, system objects that require dynamic memory may be created with custom allocators, defined by the user.

Access to the application memory manager is done using the standard functions:

The default application memory manager is set in the os_startup_initialize_free_store() function, called by the startup code when running on bare metal.

On synthetic POSIX platforms the default memory manager is os::memory::malloc_memory_resource, which uses memory from the system free store.

By default the RTOS system memory manager is the same as the application memory manager, but, for isolation reasons, it is recommended to define a separate memory mananger for the RTOS system objects.

The basic memory management class is os::rtos::memory::memory_resource, which will be standard starting with C++17. The µOS++ version of this class includes several extensions, like out of memory processing and statistics (and this is the reason the class is not defined in os::estd).

Types

◆ allocator

template<typename T >
using os::rtos::memory::allocator = typedef allocator_stateless_default_resource<T>

Type of allocator used by the system objects. Must be stateless.

Template Parameters
TType of elements to be allocated.

Definition at line 57 of file os-types.h.

◆ allocator_typed

Type of an allocator for objects of type T.

Template Parameters
Ttype of object.

The allocator uses scheduler critical sections to be thread safe, and the default memory resource associated with the given type.

Definition at line 1065 of file os-memory.h.

◆ out_of_memory_handler_t

using os::rtos::memory::out_of_memory_handler_t = typedef void (*)(void)

Type of out of memory handler.

Definition at line 142 of file os-memory.h.

◆ unique_ptr

template<typename T , typename U = T>
using os::rtos::memory::unique_ptr = typedef std::unique_ptr<T, allocator_deleter<allocator_typed<T, U> >>

Type of a RTOS unique pointer to objects of type T.

Template Parameters
Ttype of object.

The type is based on the standard unique pointer, but with the specific RTOS deleter.

Definition at line 1076 of file os-memory.h.

Function Documentation

◆ allocate_unique()

template<typename T , typename A , typename ... Args>
auto os::rtos::memory::allocate_unique ( const A &  allocator,
Args &&...  args 
)

Function template to allocate a unique pointer.

Template Parameters
TType of object to be allocated.
AAllocator type.
ArgsVariable arguments list.
Parameters
allocatorReference to allocator.
argsArguments used to construct the object of type T.
Returns
A standard unique pointer with deleter.

This function is a factory of unique pointers. It is inspired by std::allocate_shared<>.

Objects are allocated using the given allocator, and deallocated using a custom deleter associated to the allocator.

The returned unique pointers always have the deleter associated, so the object size is two pointers.

Standard allocator type definition.

Standard allocator traits definition.

Standard allocator type definition.

Standard allocator traits definition.

Definition at line 1686 of file os-memory.h.

◆ get_default_resource() [1/2]

memory_resource * os::estd::pmr::get_default_resource ( void  )
inlinenoexcept

Get the default application memory manager.

Parameters
None.
Returns
Pointer to a memory manager object instance.

If not set explicitly by the user, this function will return an instance of malloc_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 191 of file memory_resource.

◆ get_default_resource() [2/2]

memory_resource * os::rtos::memory::get_default_resource ( void  )
inlinenoexcept

Get the default RTOS system memory manager.

Parameters
None.
Returns
Pointer to a memory manager object instance.

If not set explicitly by the user, this function will return an instance of null_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 1125 of file os-memory.h.

◆ get_resource_typed()

template<typename T >
memory_resource* os::rtos::memory::get_resource_typed ( void  )
noexcept

Function template to get a memory resource.

Returns
Pointer to current memory resource.

◆ get_resource_typed< condition_variable >()

template<>
memory_resource * os::rtos::memory::get_resource_typed< condition_variable > ( void  )
inlinenoexcept

If not set explicitly by the user, this function will return an instance of null_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 1155 of file os-memory.h.

◆ get_resource_typed< event_flags >()

template<>
memory_resource * os::rtos::memory::get_resource_typed< event_flags > ( void  )
inlinenoexcept

If not set explicitly by the user, this function will return an instance of null_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 1170 of file os-memory.h.

◆ get_resource_typed< memory_pool >()

template<>
memory_resource * os::rtos::memory::get_resource_typed< memory_pool > ( void  )
inlinenoexcept

If not set explicitly by the user, this function will return an instance of null_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 1185 of file os-memory.h.

◆ get_resource_typed< message_queue >()

template<>
memory_resource * os::rtos::memory::get_resource_typed< message_queue > ( void  )
inlinenoexcept

If not set explicitly by the user, this function will return an instance of null_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 1200 of file os-memory.h.

◆ get_resource_typed< mutex >()

template<>
memory_resource * os::rtos::memory::get_resource_typed< mutex > ( void  )
inlinenoexcept

If not set explicitly by the user, this function will return an instance of null_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 1215 of file os-memory.h.

◆ get_resource_typed< semaphore >()

template<>
memory_resource * os::rtos::memory::get_resource_typed< semaphore > ( void  )
inlinenoexcept

If not set explicitly by the user, this function will return an instance of null_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 1230 of file os-memory.h.

◆ get_resource_typed< thread >()

template<>
memory_resource * os::rtos::memory::get_resource_typed< thread > ( void  )
inlinenoexcept

If not set explicitly by the user, this function will return an instance of null_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 1140 of file os-memory.h.

◆ get_resource_typed< timer >()

template<>
memory_resource * os::rtos::memory::get_resource_typed< timer > ( void  )
inlinenoexcept

If not set explicitly by the user, this function will return an instance of null_memory_resource on bare metal platforms and of malloc_memory_resource on POSIX platforms.

Definition at line 1245 of file os-memory.h.

◆ init_once_default_resource()

void os::rtos::memory::init_once_default_resource ( void  )

◆ make_shared()

template<typename T , typename ... Args>
std::enable_if<!std::is_array<T>::value, std::shared_ptr<T> >::type os::rtos::make_shared ( Args &&...  args)
inline

Create an object that is owned by a shared_ptr and is allocated using the RTOS system allocator.

Parameters
argsArguments for the T object's constructor.
Returns
A shared_ptr that owns the newly created object.
Exceptions
*An exception may be thrown from allocate() or from the constructor of T.

Definition at line 174 of file os.h.

◆ malloc_resource()

memory_resource * os::rtos::memory::malloc_resource ( void  )
noexcept

Get the address of a memory manager based on POSIX malloc().

Parameters
None.
Returns
Pointer to a memory manager object instance.
See also
malloc_memory_resource

Definition at line 191 of file os-memory.cpp.

◆ new_delete_resource()

memory_resource* os::estd::pmr::new_delete_resource ( void  )
noexcept

Get the address of a memory manager based on new/delete.

Parameters
None.
Returns
Pointer to a memory manager object instance.

◆ null_memory_resource()

memory_resource* os::estd::pmr::null_memory_resource ( void  )
noexcept

Get the address of an ineffective memory manager.

Parameters
None.
Returns
Pointer to a memory manager object instance.

◆ operator delete() [1/3]

void operator delete ( void *  ptr)
noexcept

Deallocate the dynamically allocated object instance.

Parameters
ptrPointer to object.
Returns
Nothing.

The deallocation function (3.7.4.2) called by a delete-expression to render the value of ptr invalid.

ptr shall be a null pointer or its value shall be a value returned by an earlier call to the (possibly replaced) operator new(os::std::size_t) or operator new(os::std::size_t,const std::nothrow_t&) which has not been invalidated by an intervening call to operator delete(void*).

If ptr is null, does nothing. Otherwise, reclaims the storage allocated by the earlier call to operator new.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 325 of file new.cpp.

◆ operator delete() [2/3]

void operator delete ( void *  ptr,
std::size_t  bytes 
)
noexcept

Deallocate the dynamically allocated object instance.

Parameters
ptrPointer to object.
bytesNumber of bytes to deallocate.
Returns
Nothing.

The deallocation function (3.7.4.2) called by a delete-expression to render the value of ptr invalid.

ptr shall be a null pointer or its value shall be a value returned by an earlier call to the (possibly replaced) operator new() which has not been invalidated by an intervening call to operator delete(void*).

If ptr is null, does nothing. Otherwise, reclaims the storage allocated by the earlier call to operator new.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 376 of file new.cpp.

◆ operator delete() [3/3]

void operator delete ( void *  ptr,
const std::nothrow_t &  nothrow 
)
noexcept

Deallocate the dynamically allocated object instance (nothrow).

Parameters
ptrPointer to object.
nothrow
Returns
Nothing.

The deallocation function (3.7.4.2) called by the implementation to render the value of ptr invalid when the constructor invoked from a nothrow placement version of the new-expression throws an exception.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 416 of file new.cpp.

◆ operator delete[]() [1/3]

void operator delete[] ( void *  ptr)
noexcept

Deallocate the dynamically allocated array of object.

Parameters
ptrPointer to array of objects.
Returns
Nothing.

The deallocation function (3.7.4.2) called by the array form of a delete-expression to render the value of ptr invalid.

If ptr is null, does nothing. Otherwise, reclaims the storage allocated by the earlier call to operator new.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 455 of file new.cpp.

◆ operator delete[]() [2/3]

void operator delete[] ( void *  ptr,
std::size_t  bytes 
)
noexcept

Deallocate the dynamically allocated array of object.

Parameters
ptrPointer to array of objects.
bytesNumber of bytes to deallocate.
Returns
Nothing.

The deallocation function (3.7.4.2) called by the array form of a delete-expression to render the value of ptr invalid.

If ptr is null, does nothing. Otherwise, reclaims the storage allocated by the earlier call to operator new.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 487 of file new.cpp.

◆ operator delete[]() [3/3]

void operator delete[] ( void *  ptr,
const std::nothrow_t &  nothrow 
)
noexcept

Deallocate the dynamically allocated array of object (nothrow).

Parameters
ptrPointer to array of objects.
nothrow
Returns
Nothing.

The deallocation function (3.7.4.2) called by the implementation to render the value of ptr invalid when the constructor invoked from a nothrow placement version of the array new-expression throws an exception.

If ptr is null, does nothing. Otherwise, reclaims the storage allocated by the earlier call to operator new.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 517 of file new.cpp.

◆ operator new() [1/2]

void* operator new ( std::size_t  bytes)

Allocate space for a new object instance.

Parameters
bytesNumber of bytes to allocate.
Returns
Pointer to allocated object.

The allocation function (3.7.4.1) called by a new-expression (5.3.4) to allocate a storage of size bytes suitably aligned to represent any object of that size.

Return a non-null pointer to suitably aligned storage (3.7.4), or else throw a bad-alloc exception. This requirement is binding on a replacement version of this function.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 148 of file new.cpp.

◆ operator new() [2/2]

void* operator new ( std::size_t  bytes,
const std::nothrow_t &  nothrow 
)
noexcept

Allocate space for a new object instance (nothrow).

Parameters
bytesNumber of bytes to allocate.
nothrow
Returns
Pointer to allocated object.

Same as new(bytes), except that it is called when a C++ program prefers a null pointer result as an error indication, instead of a bad_alloc exception.

Return a non-null pointer to suitably aligned storage (3.7.4), or else return a null pointer. This nothrow version of operator new returns a pointer obtained as if acquired from the (possibly replaced) ordinary version. This requirement is binding on a replacement version of this function.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 210 of file new.cpp.

◆ operator new[]() [1/2]

void* operator new[] ( std::size_t  bytes)

Allocate space for an array of new object instances.

Parameters
bytesNumber of bytes to allocate.
Returns
Pointer to allocated object.

The allocation function (3.7.4.1) called by the array form of a new-expression (5.3.4) to allocate size bytes of storage suitably aligned to represent any array object of that size or smaller.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 269 of file new.cpp.

◆ operator new[]() [2/2]

void* operator new[] ( std::size_t  bytes,
const std::nothrow_t &  nothrow 
)
noexcept

Allocate space for an array of new object instances (nothrow).

Parameters
bytesNumber of bytes to allocate.
nothrow
Returns
Pointer to allocated object.

Same as new[](size), except that it is called by a C++ program that prefers a null pointer result as an error indication, instead of a bad_alloc exception.

Note
A C++ program may define a function with this function signature that displaces the default version defined by the C++ standard library.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 292 of file new.cpp.

◆ operator!=() [1/2]

bool os::rtos::memory::operator!= ( const memory_resource lhs,
const memory_resource rhs 
)
inlinenoexcept

Compare the memory_resource instances for inequality.

Parameters
lhsFirst instance to compare.
rhsSecond instance to compare.
Return values
trueThe two object memory_resource instances are not equal.
falseThe two object memory_resource instances are equal.

Definition at line 1472 of file os-memory.h.

◆ operator!=() [2/2]

template<typename T1 , typename T2 , typename L , F get_resource>
bool os::rtos::memory::operator!= ( const allocator_stateless_polymorphic_synchronized< T1, L, get_resource > &  lhs,
const allocator_stateless_polymorphic_synchronized< T2, L, get_resource > &  rhs 
)
noexcept

◆ operator==() [1/2]

bool os::rtos::memory::operator== ( const memory_resource lhs,
const memory_resource rhs 
)
inlinenoexcept

Compare the memory_resource instances for equality.

Parameters
lhsFirst instance to compare.
rhsSecond instance to compare.
Return values
trueThe two object memory_resource instances are equal.
falseThe two object memory_resource instances are not equal.

Definition at line 1466 of file os-memory.h.

◆ operator==() [2/2]

template<typename T1 , typename T2 , typename L , F get_resource>
bool os::rtos::memory::operator== ( const allocator_stateless_polymorphic_synchronized< T1, L, get_resource > &  lhs,
const allocator_stateless_polymorphic_synchronized< T2, L, get_resource > &  rhs 
)
noexcept

◆ set_default_resource() [1/2]

memory_resource * os::estd::pmr::set_default_resource ( memory_resource res)
noexcept

Set the default application memory manager.

Parameters
resPointer to new memory manager object instance.
Returns
Pointer to previous memory manager object instance.

Definition at line 67 of file memory-resource.cpp.

◆ set_default_resource() [2/2]

memory_resource * os::rtos::memory::set_default_resource ( memory_resource res)
noexcept

Set the default RTOS system memory manager.

Parameters
resPointer to new memory manager object instance.
Returns
Pointer to previous memory manager object instance.

On bare metal applications, this function is called from os_startup_initialize_free_store(), during the system startup, with a memory manager handling the free RAM.

Warning
This function is not thread safe.

Definition at line 208 of file os-memory.cpp.

◆ set_resource_typed()

template<typename T >
memory_resource* os::rtos::memory::set_resource_typed ( memory_resource res)
noexcept

Function template to set a memory resource.

Parameters
resPointer to memory resource.
Returns
Pointer to previous memory resource.

◆ set_resource_typed< condition_variable >()

On bare metal applications, this function is called from os_startup_initialize_free_store(), during the system startup, with a memory manager specific to this object type.

Definition at line 246 of file os-memory.cpp.

◆ set_resource_typed< event_flags >()

On bare metal applications, this function is called from os_startup_initialize_free_store(), during the system startup, with a memory manager specific to this object type.

Definition at line 264 of file os-memory.cpp.

◆ set_resource_typed< memory_pool >()

On bare metal applications, this function is called from os_startup_initialize_free_store(), during the system startup, with a memory manager specific to this object type.

Definition at line 282 of file os-memory.cpp.

◆ set_resource_typed< message_queue >()

On bare metal applications, this function is called from os_startup_initialize_free_store(), during the system startup, with a memory manager specific to this object type.

Definition at line 300 of file os-memory.cpp.

◆ set_resource_typed< mutex >()

On bare metal applications, this function is called from os_startup_initialize_free_store(), during the system startup, with a memory manager specific to this object type.

Definition at line 318 of file os-memory.cpp.

◆ set_resource_typed< semaphore >()

On bare metal applications, this function is called from os_startup_initialize_free_store(), during the system startup, with a memory manager specific to this object type.

Definition at line 336 of file os-memory.cpp.

◆ set_resource_typed< thread >()

On bare metal applications, this function is called from os_startup_initialize_free_store(), during the system startup, with a memory manager specific to this object type.

Definition at line 228 of file os-memory.cpp.

◆ set_resource_typed< timer >()

On bare metal applications, this function is called from os_startup_initialize_free_store(), during the system startup, with a memory manager specific to this object type.

Definition at line 354 of file os-memory.cpp.