Except that where misra is applied, there often is no dynamic allocation at all.
Except that where misra is applied, there often is no dynamic allocation at all.
As an example, we weren't allowed to use the C++ string class, and had to find a "safer" string class for C++.
(Not sure about MISRA - most of my experience is with the ISO standard, and MISRA is not mandated by it).
Or you make it static. You can work around it just fine.
If you haven't, I strongly encourage taking a workshop/course on requirements engineering (not specific to SW nor safety). One thing that stood out is a requirement that says things like "indeterminate" or "large" are red flags. A requirement should state bounds on what sizes it should handle.
> Or when you need a temporary buffer that’s too big to live on the stack?
Do you have an example of where this may occur in a safety critical system?
I've forgotten the details, but many/most forbidden things are allowed in the code provided you have watchdogs for mitigation - so if things did fail it could safely shut down. I don't recall if dynamic allocation fell into that category.
don't put big temp. buffers onto the stack, put them into your .data segment. (i.e. global).