[<<][c][>>][..]
Wed Aug 18 18:34:27 CEST 2010

Static allocation: stacks and queues.

* In an embedded application, if a static structure is built at
  run-time, built up from many small fragments of memory, it might be
  better to allocate from a stack than to pollute the heap.  If the
  amount of memory needed is predictable, the stack size can even be
  fixed at compile time.  This requires a two-pass algorithm though.

* Instead of writing pointers to a work queue, it is also possible to
  write self-contained objects.  This avoids malloc() for the payload
  data.

Both are really the same pattern: ``catch'' memory allocations and
implement them differently based on knowledge of the memory lifetime.




[Reply][About]
[<<][c][>>][..]