C++ STM32H7 + TouchGFX + ThreadX + ESP32 MQTT - heap allocation
Hi, I'm working under not very restricted medical device with WiFi logging. This is quite a big project, requires processing of many string data so I want some easier tools. I know that in general it is not good to use heap on embedded, but H7 seems to have so much resources.
One part is communication with ESP32 - it has UART interface with custom JSON string protocol based on cJSON library. This library parses cstring to heap allocated structure, and in the same function free it. I added custom smart pointer wrapper to make it safer in deallocating.
To further secure messaging I use custom option wrapper (like optional in >= C++20) - agan move semantics.
Mostly I use std::strings to construct messages provided to ESP32, pass it between functions hoping that move semantics works.
I know what is heap segmentation.
And my questions:
- is move semantics with rule of zero works when compiling with -std=gnu++14?
- relatively short strings are processed on stack, is it true in embedded?
- can I use heap allocation for processing temporary strings without worry about segmentation?
- how can I check/profile dynamic memory in STM32CubeIDE to see if segmentation happens? Seems memory map shows only static memory.
Thank you for help :grinning_face:
