Most software developers stick to the straight and narrow in their use ofC’s malloc() library function – and its faithful companion free ()- in the constrained firmware environment of most embedded designs. But inthis week’s Embedded.com Tech Focus Newsletter , Colin Walls in “Dynamicmemory and heap contiguity“ provides some tips on how to livedangerously using dynamic allocation and do so with reasonable safety.
In hisarticle, Colin does an excellent job in describing some new techniquesthat he’s convinced me are worth trying, especially if you are looking fora way out of the performance and deterministic straight jacket that dependenceon malloc imposes.
Many current and future designs using 32 bit and multicore MCU implementationswill require either a safer way to use dynamic allocation or some way toextend static allocation. Included in the newsletter are a number of designarticles and blogs on various static and dynamic techniques to achieve this.In addition, a number of other articles worth checking out include:
Colin and the other contributors to Embedded.com haven't been the only oneslooking at ways to live dangerously. Here are a few papers I found on howto use dynamic allocation in a number of next generation designs:
A scalable lock-free dynamic memory allocator
Dynamic memory allocators for real-time embedded systems
Using Palloc for parallel dynamic memory allocation
Dynamic memory management for embedded real-time systems
Efficient dynamic heap allocation of scratchpad memory
As you read these various perspectives of the issue of dynamic versus staticmemory allocation, keep in mind the warning that Colin includes in his article:
“The word “dynamic” should – and normally does – ring alarm bellswith embedded software developers,” he writes. “The dynamic allocation/creationof anything is fraught with problems in real time and deeply embedded systems,so, wherever possible, static alternatives should be considered. ”
But, he adds, while dynamic memory allocation is a good example of wherethis caution is wise, a clear understanding of the issues involved can leadto implementations that are appropriate for your embedded design, withoutliving too dangerously.
Embedded.com Site Editor Bernard Cole is also editor of thetwice-a-week Embedded.comnewsletters as well as a partner in the TechRite Associates editorialservices consultancy. He welcomes your feedback. Send an email to , or call928-525-9087.