malloc() and alloc() (and their general concept) in any embedded system
are
generally considered a bad idea, since it can lead to memory fragmentation
and starvation.
Considering a system with 8K of memory. You allocate 4 2K blocks, free
the
1st and 3rd, then try to allocate 4K. There's 4K free, but it's not
contiguous.
Most embedded systems, particularly those without an MMU or an
automatic
garbage collection mechanism (Java, some others), are not recommended for
typical dynamic memory allocations. They can also be expensive, particularly
if you have a number of allocated blocks and the block list has to be
traversed, or you malloc/free a lot.
--John
On Thursday 10 July 2003 11:35 am, Daniel Néri wrote:
> Peter Mueller <[email protected]> writes:
> > /cygdrive/c/mspgcc/lib/gcc-lib/msp430/3.2.3/../../../../msp430/lib/msp2/l
> >ibc.a(m alloc.o)(.text+0x1e): In function `malloc':
> > /cygdrive/c/mspgcc-source/msp430/msp430-libc/src/stdlib/malloc.c:21:
> > internal er
> > ror: unsupported relocation error
>
> Sorry, I've never used malloc on MSP430, and I guess most others don't
> use it either. It isn't very useful when you only have 2 kilobytes of
> RAM (or less) to play with.
>
> Can't you change your code to use statically allocated memory instead?
>
>
> Regards,
> --Daniel
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Parasoft
> Error proof Web apps, automate testing & more.
> Download & eval WebKing and get a free book.
> www.parasoft.com/bulletproofapps
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users