Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

RE: [lpc2000] Simple heap

2006-01-18 by Paul Curtis

Hi, 

> >I am looking for simple dynamic memory allocation management for 
> >LPC213x. 
> >
> In C you may use malloc(), alloc() and free.

In many cases this is a simple thing to do, but it's probably not the
best thing you can do.  I would hazard a guess that most implementations
of these functions in standard offerings are rather poor.  They will
have low code overhead, use memory efficiently, and have O(n)
performance when n is the number of blocks in the free list.  They will
suffer from fragmentation, of course.  You'll probably want to replace
that with a system that suits your needs--ones that are fast require
more memory or waste memory in each allocated block.  Ones that two to
conserve memory will be slow.  The ones provided by compiler libraries
will be ones that satisfy the needs of the C standard and programs in
general, and won't serve the needs of all users.  Hybrid schemes are
attractive, with small blocks that are allocated and deallocated
frequently using a different manager from blocks that are big (for some
definition of big).

Having written many memory managers in my time, for interpreted and
compiled languages, there is no one solution for any application.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and now MAXQ processors

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.