FridgeFreezer

malloc() - is it really necessary?

Discussion created by FridgeFreezer on Apr 6, 2010
Latest reply on Apr 12, 2010 by FridgeFreezer

Before you all say "yes of course it is" I'd better explain myself:

 

In our application we are using a micro "bare" - no RTOS, no other processes etc. just one main() loop going round and round as is traditional. All data which is not transient is in a global data structure passed by pointer to any functions.

 

The code we inherited does not use malloc() at all and works fine, but developing for a newer micro, some of the Freescale drivers/example code etc. use malloc() to setup buffers and so on. Now, this is clearly of use where you are calling different programs and returning and so on, but in a dedicated environment it seems rather pointless and a potential source of bugs to be including more libraries than we have to.

 

Anyone care to expand - is it necessary / required / useful / non-essential / totally useless in our application?

Outcomes