µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
Memory Management Options

Definitions used to configure the memory management features. More...

#define OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS
 Prevent any dynamic memory allocation, everything should be static.
 
#define OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES
 Ask for separate RTOS dynamic memory and define its size.
 
#define OS_INTEGER_RTOS_ALLOC_THREAD_POOL_SIZE
 Define a pool of thread objects.
 
#define OS_INTEGER_RTOS_ALLOC_CONDITION_VARIABLE_POOL_SIZE
 Define a pool of condition variable objects.
 
#define OS_INTEGER_RTOS_ALLOC_EVENT_FLAGS_POOL_SIZE
 Define a pool of event flags objects.
 
#define OS_INTEGER_RTOS_ALLOC_MEMORY_POOL_POOL_SIZE
 Define a pool of memory pool objects.
 
#define OS_INTEGER_RTOS_ALLOC_MESSAGE_QUEUE_POOL_SIZE
 Define a pool of message queue objects.
 
#define OS_INTEGER_RTOS_ALLOC_MUTEX_POOL_SIZE
 Define a pool of mutex objects.
 
#define OS_INTEGER_RTOS_ALLOC_SEMAPHORE_POOL_SIZE
 Define a pool of semaphore objects.
 
#define OS_INTEGER_RTOS_ALLOC_TIMER_POOL_SIZE
 Define a pool of timer objects.
 
#define OS_TYPE_RTOS_MEMORY_RESOURCE
 The type of the memory manager to be used for the RTOS system area.
 
#define OS_TYPE_APPLICATION_MEMORY_RESOURCE
 The type of the memory manager to be used for the application free store.
 

Detailed Description

Definitions used to configure the memory management features.

Macro Definition Documentation

◆ OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS

#define OS_EXCLUDE_DYNAMIC_MEMORY_ALLOCATIONS

Prevent any dynamic memory allocation, everything should be static.

For special applications that require all objects to be statically allocated, this option not only allocates all system objects statically (like the main and idle thread), but also installs a null memory manager, that guarantees a loud bang if a dynamic allocation (like malloc() or new) is attempted by the application.

Default
Allow dynamic allocations.

Definition at line 82 of file os-app-config.h.

◆ OS_INTEGER_RTOS_ALLOC_CONDITION_VARIABLE_POOL_SIZE

#define OS_INTEGER_RTOS_ALLOC_CONDITION_VARIABLE_POOL_SIZE

Define a pool of condition variable objects.

This option instructs the startup code to create a pool of empty condition variable objects of the given size. This pool can be used as an allocator to create life condition variable objects using rtos::memory::allocate_unique<condition_variable> (...).

The pool is dynamically allocated, and never deallocated.

Default
Do not create the pool of condition variable objects.

Definition at line 138 of file os-app-config.h.

◆ OS_INTEGER_RTOS_ALLOC_EVENT_FLAGS_POOL_SIZE

#define OS_INTEGER_RTOS_ALLOC_EVENT_FLAGS_POOL_SIZE

Define a pool of event flags objects.

This option instructs the startup code to create a pool of empty event flags objects of the given size. This pool can be used as an allocator to create life event flags objects using rtos::memory::allocate_unique<event_flags> (...).

The pool is dynamically allocated, and never deallocated.

Default
Do not create the pool of event flags objects.

Definition at line 155 of file os-app-config.h.

◆ OS_INTEGER_RTOS_ALLOC_MEMORY_POOL_POOL_SIZE

#define OS_INTEGER_RTOS_ALLOC_MEMORY_POOL_POOL_SIZE

Define a pool of memory pool objects.

This option instructs the startup code to create a pool of empty memory pool objects of the given size. This pool can be used as an allocator to create life memory pool objects using rtos::memory::allocate_unique<memory_pool> (...).

The pool is dynamically allocated, and never deallocated.

Default
Do not create the pool of memory pool objects.

Definition at line 172 of file os-app-config.h.

◆ OS_INTEGER_RTOS_ALLOC_MESSAGE_QUEUE_POOL_SIZE

#define OS_INTEGER_RTOS_ALLOC_MESSAGE_QUEUE_POOL_SIZE

Define a pool of message queue objects.

This option instructs the startup code to create a pool of empty message queue objects of the given size. This pool can be used as an allocator to create life message queue objects using rtos::memory::allocate_unique<message_queue> (...).

The pool is dynamically allocated, and never deallocated.

Default
Do not create the pool of message queue objects.

Definition at line 189 of file os-app-config.h.

◆ OS_INTEGER_RTOS_ALLOC_MUTEX_POOL_SIZE

#define OS_INTEGER_RTOS_ALLOC_MUTEX_POOL_SIZE

Define a pool of mutex objects.

This option instructs the startup code to create a pool of empty mutex objects of the given size. This pool can be used as an allocator to create life mutex objects using rtos::memory::allocate_unique<mutex> (...).

The pool is dynamically allocated, and never deallocated.

Default
Do not create the pool of mutex objects.

Definition at line 206 of file os-app-config.h.

◆ OS_INTEGER_RTOS_ALLOC_SEMAPHORE_POOL_SIZE

#define OS_INTEGER_RTOS_ALLOC_SEMAPHORE_POOL_SIZE

Define a pool of semaphore objects.

This option instructs the startup code to create a pool of empty semaphore objects of the given size. This pool can be used as an allocator to create life semaphore objects using rtos::memory::allocate_unique<semaphore> (...).

The pool is dynamically allocated, and never deallocated.

Default
Do not create the pool of semaphore objects.

Definition at line 223 of file os-app-config.h.

◆ OS_INTEGER_RTOS_ALLOC_THREAD_POOL_SIZE

#define OS_INTEGER_RTOS_ALLOC_THREAD_POOL_SIZE

Define a pool of thread objects.

This option instructs the startup code to create a pool of empty thread objects of the given size. This pool can be used as an allocator to create life thread objects using rtos::memory::allocate_unique<thread> (...).

The pool is dynamically allocated, and never deallocated.

Default
Do not create the pool of thread objects.

Definition at line 121 of file os-app-config.h.

◆ OS_INTEGER_RTOS_ALLOC_TIMER_POOL_SIZE

#define OS_INTEGER_RTOS_ALLOC_TIMER_POOL_SIZE

Define a pool of timer objects.

This option instructs the startup code to create a pool of empty timer objects of the given size. This pool can be used as an allocator to create life timer objects using rtos::memory::allocate_unique<timer> (...).

The pool is dynamically allocated, and never deallocated.

Default
Do not create the pool of timer objects.

Definition at line 240 of file os-app-config.h.

◆ OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES

#define OS_INTEGER_RTOS_DYNAMIC_MEMORY_SIZE_BYTES

Ask for separate RTOS dynamic memory and define its size.

To protect the system objects from possible application bugs, it is recommended to define a separate allocation arena with a separate memory manager.

If this definition is present, a memory block with the requested size is allocated with the application allocator (thus reducing the size of the application free store), and a memory resource object is created to use this separate memory.

The default memory manager is os::memory::lifo and can be change by defining OS_TYPE_RTOS_MEMORY_RESOURCE.

Default
Use of application free store for system objects too.

Definition at line 103 of file os-app-config.h.

◆ OS_TYPE_APPLICATION_MEMORY_RESOURCE

#define OS_TYPE_APPLICATION_MEMORY_RESOURCE

The type of the memory manager to be used for the application free store.

The default memory manager is os::memory::first_fit_top, which is not deterministic, but reasonably fast.

If your application is very active with random allocation, be sure tolerates restarts due to fragmentation.

Default
The default memory manager is os::memory::first_fit_top.

Definition at line 280 of file os-app-config.h.

◆ OS_TYPE_RTOS_MEMORY_RESOURCE

#define OS_TYPE_RTOS_MEMORY_RESOURCE

The type of the memory manager to be used for the RTOS system area.

The default memory manager is os::memory::lifo, which is guaranteed deterministic for allocations and prevents fragmentation, but has the disadvantage that favours deallocations when performed in the reverse order of allocations (actually older blocks are reused only after all more recent blocks are freed).

The LIFO allocation policy is a perfect fit when most objects are created during the initialisation phase, and later on thee is little activity.

Redefine it to os::memory::first_fit_top if your application is more dynamic, but be sure it tolerates restarts due to fragmentation.

Default
The default memory manager is os::memory::lifo.

Definition at line 264 of file os-app-config.h.