Understanding memory allocation
Memory allocation isn’t necessarily at the top of a developer’s list of favorite topics to consider when developing an application – it just isn’t all that glamorous. Dynamic memory-allocation has to do with allocating memory as it is needed during runtime, rather than during compile time. With desktop applications, memory is generally available whenever it is needed, so it isn’t given a second thought; memory is simply a malloc
call away. And, when the memory is no longer needed, it will be unallocated with free
.
Unlike the carefree dynamic memory-allocation schemes in a desktop environment, embedded-systems programmers typically must be more careful about how memory is dynamically allocated. In an embedded system, there’s typically less memory available, and there are additional memory-related requirements, such as regulatory requirements and timing constraints.
Many high-reliability and safety-critical...