Skip to content

Dynamic task creation possible without using system heap? #15

@haunma

Description

@haunma

I'm just getting started with FreeRTOS-Cpp and was playing with a simple example from FreeRTOS+TCP where tasks are spawned to handle each client connection to TCP port 7 (echo). In that scenario, if I understand the FreeRTOS memory scheme correctly, you can run with no system heap because FreeRTOS dynamically creates/destroys objects from its own "heap" which is actually a fixed-length array. So, it provides its own malloc/free.

So, enter FreeRTOS-Cpp. What would be the cleanest way to create FreeRTOS::Task objects as TCP connections come in? If I use new/delete, then that is engaging the system heap in addition to the FreeRTOS pseudo-heap; it also implies the objects will need to self-delete somehow at the end of their task functions. Alternatively, I could use pvPortMalloc() to get memory for the class instance. Is there any alternative I'm missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions