I have an embedded system using an RTOS. The one weakness of this RTOS is that it has a weak memory manager. You can pre-define the block size that will be created in the memory pool, but this block size is always fixed. That means that it won't be able to allocate the exact amount of memory that you need - it will turn out to always be too much. The only exception to this is if I pre-define the block size to be the same as the size of my most often used data object. But I have two different types of data objects (ie. different sizes), and they are both used often. Soo, I have avoided using this memory manager, and have been using static arrays instead.
I have a list of data objects that I will need to create during run time. The number of objects on this list at any given time during runtime is unknown, although there can a be worst case maximum limit to the size of this list. So, my question is this: Which is preferable for my situation, malloc() or pre-defining a static array that is equal to the worst case size ?
Thx. Cheers, Albert