malloc in embedded systems

From: phileo (phileo98_at_yahoo.com)
Date: 02/04/04


Date: 3 Feb 2004 20:01:06 -0800

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



Relevant Pages

  • Re: malloc in embedded systems
    ... > RTOS is that it has a weak memory manager. ... You can pre-define the ...
    (comp.arch.embedded)
  • Re: Larry Wall, on Tcl
    ... This relieves the programmer of one nasty task, namely, ... releasing data objects that are no longer needed. ... variable's value is modified to require a different amount of memory, ...
    (comp.lang.tcl)
  • Re: malloc in embedded systems
    ... >RTOS is that it has a weak memory manager. ... >block size that will be created in the memory pool, ... The only exception to this is if I pre-define the block ...
    (comp.arch.embedded)
  • Re: difference
    ... >>I think integer constants are objects, ... They occupy ... some sort of memory storage -- registers, virtual memory, etc. ... Whether data objects exist or not may be irrelevant ...
    (comp.lang.c)
  • Re: size?
    ... Jrdman wrote: ... It's possible to estimate the size your data objects may take (I say ... only estimate because of padding and other overheads), ... more difficult to say how much memory your code takes. ...
    (comp.lang.c)