|
Re: Malloc, etc...
Ryan,
As a firmware developer by trade, we don't tend to use malloc in real embedded applications. The trouble is that there just isn't room for linked lists and other non-static memory uses.
If you need a list I would suggest a global queue or stack of a static size (10 to 20 items [or even an array]). This is to ensure other parts of your application get the memory they need. Now to get into the data hiding aspect that you probably want, make a few accessor functions to this global item (GetValue and PutValue) that handle talking to the global structure.
The reason for this is that the stack needs to be protected and if a link list goes wrong it could corrupt all sorts of memory. Another reason is that embedded applications just don't have the memory management code in them to handle malloc and free.
-Jim Wright
|