docs/user-manual/framework/memory-management/index.md
F´ provides two complementary patterns for managing memory in flight software systems, each designed for different phases of the application lifecycle and use cases. This document provides an overview of these patterns and links to the appropriate in-depth documentation.
Flight software coding standards typically forbid dynamic memory allocation during runtime operation for safety and reliability reasons. However, memory management is still necessary during both system initialization and runtime operations. F´ addresses these needs through two distinct patterns:
| Pattern | Phase | Purpose | Key Components |
|---|---|---|---|
| Memory Allocation | Initialization | Allocate memory blocks (outside of stack) during system initialization for use during runtime | Fw::MemAllocator (interface), Fw::MallocAllocator (implementation), Fw::MemAllocatorRegistry |
| Buffer Pool | Runtime | Allocate buffers during runtime from a pre-allocated buffer pool | Svc::BufferManager |
Used during: System initialization
Document: Memory Allocation with Fw::MemAllocator
The Memory Allocation pattern uses the Fw::MemAllocator interface to allocate memory blocks during system initialization. This is appropriate in the following scenarios:
Key Features:
Fw::MallocAllocator implementation which delegates to malloc()/free()Fw::MemAllocatorRegistry for managing multiple allocator typesExample Use Cases:
Svc::BufferManagerSvc::FrameAccumulatorTypical Workflow:
Fw::MemAllocator&configureTopology() via a component configure() method)teardownTopology() via a component teardown() method)Used during: Runtime operation
Document: Buffer Pool with Svc.BufferManager
The Buffer Pool pattern provides safe runtime buffer management through pre-allocated buffer pools. This pattern allows components to request and return buffers during normal operation without violating flight software coding standards. This is appropriate when:
Key Features:
Example Use Cases:
Typical Workflow:
allocate port during operationdeallocate port