Design templates for flexible process chaining without dynamic memory allocation

Some Embedded developers, and indeed standards committees (looking at you MISRA(ble) lot) discourage the use of dynamic memory allocation at runtime in embedded system programming.

Can anyone please share any practices and design patterns that allow for the flexible creation of processes and process chains at run time that do not require dynamic memory allocation?

I think you may be interested at this page of ChibiOS docs as an example what options can be provided by a RTOS. ChibiOS itself doesn’t use dynamic memory by design, but it provides various memory allocation options for user data - including dynamic allocation from heaps.


Is anybody running ChibiOS on Daisy?

1 Like

It’s possible to use std::array with a non type template parameter for size. for example

#define <array>

template <size_t n>
Class Wavetable
    //Some code
    std::array<float,n> table_;

The way I understand it std::array is a templatized wrapper for c style arrays so you can get the benefits of container operations without DMA concerns