Hello,
As part of the rtems_allocator integration, we need to decide how applications should select the heap allocator used by RTEMS.
There are two main decisions.
Static or runtime configuration
The allocator could be selected statically at build time:
#define CONFIGURE_HEAP_ALLOCATOR RTEMS_ALLOCATOR_TLSF
Alternatively, the allocator could be selected at runtime by constructing or registering an rtems_allocator object.
One allocator or separate allocators
RTEMS normally has two heap instances:
_Workspace_Area, used for internal RTEMS objects.RTEMS_Malloc_Heap, used by functions such asmalloc().
We could use one configured allocator implementation for both heaps:
#define CONFIGURE_HEAP_ALLOCATOR RTEMS_ALLOCATOR_TLSF
Alternatively, users could configure them separately:
#define CONFIGURE_WORKSPACE_HEAP_ALLOCATOR RTEMS_ALLOCATOR_FIRST_FIT
#define CONFIGURE_MALLOC_HEAP_ALLOCATOR RTEMS_ALLOCATOR_TLSF
When CONFIGURE_UNIFIED_WORK_AREAS is enabled, both use the same heap, so they would have to use the same allocator.
I would like feedback on the following questions:
- Should allocator selection happen at build time or runtime?
- Should the workspace and malloc heaps always use the same allocator?
- Is there a use case for configuring the two heaps separately?
- How should applications obtain the configured workspace or malloc rtems_allocator object when direct access is needed?