Olin Lathrop wrote: > Why do you need to dynamically allocate memory anyway? This is rather > unusual in a small embedded system, and likely indicates big system > thinking > on a small system. FWIW, we use dynamic memory allocation in all of our current projects (on 24H and 33F). In fact, some of the things we use it for, would be impossible to implement in any other way. > Another drawback of dynamic memory on a small system is how to guarantee > you > won't run out. If you don't know how much memory you need up front, then > how do you know you don't need more than there is available under the > right > set of input conditions. And if you do use malloc or the like, what are > you > going to do when it fails? Punting back to the operating system with a > non-zero exit status doesn't work here. In our case, we just tell the user that there's no more RAM (because if it happens, they're the ones who added too many things to begin with). When there's no user input, there's no risk of running out of RAM. Memory gets allocated during initialization and doesn't change. But, yeah -- stay away from malloc() if you can help it. :) Vitaliy -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist