I have to write white complex application for embedded device in C. Runtime (libc) does not support malloc/calloc/realloc/free or any other kind of dynamic memory management.
What are best practice for such cases?
Application is complex. for instance, it should do public key cryptography. Device is specific ARM-M0 based module. Compiler is 4.6.0 in C99 mode. It is bare metal (no OS), 64K of memory. I do not care about portability.
Best How To :
You could choose:
avoiding any kind of dynamic memory
implement your own
free (or tune some existing
malloc library for your need)
implement your own garbage collector (I guess that simple mark&sweep could be suitable in your case). Look e.g. into OpenMirage as an example showing that a GC-ed approach could make sense. Read the Gc HandBook for more.
alloca (probably wrong)
use region or arena allocation techniques
BTW, the complexity of (e.g. cryptographic) algorithms is orthogonal to dynamic memory management....
Notice that you could e.g. customize your compiler chain (e.g. with MELT if using a recent GCC) to e.g. validate some specific coding rules related to your particular memory manager (or GC).