Heapless C/C++, embedded systems requirements out of scope

Thierry Moreau thierry.moreau@connotech.com
Sun Oct 9 10:06:00 GMT 2011

Charles Wilson wrote:
> The reason many real-time systems disallow use of the heap is because it
> is well-known that heap management does not have a bounded-time
> implementation.  Usually during free()/delete, typical heap management
> code often tries to coalesce freed blocks, or perform various other
> book-keeping. The length of time this takes is dependent on the usage
> pattern of the process.  There are approaches to minimize the
> 'unboundedness' but that's like attempting to be "a little bit pregnant".

In a properly designed embedded system, the finish-time-unpredictable 
portion of free()/delete/delete[] is deferred to a low priority runtime 
context, with a queue of requests. Then the heap is available to 
time-critical contexts. The system design must ensure that activity 
bursts are handled: the compiler can not assist this aspect.

Otherwise, yes, there are embedded systems where a heap is absent.

Anyway, such requirements appears out of scope for GCC development.


- Thierry Moreau

CONNOTECH Experts-conseils inc.
9130 Place de Montgolfier
Montreal, QC, Canada H2M 2A1

Tel. +1-514-385-5691

More information about the Gcc mailing list