Datasheet

The C and C++ Libraries
ARM DUI 0067D Copyright © 1999-2001 ARM Limited. All rights reserved. 4-59
your memory model can supply a block of memory at a lower address than the
first one supplied.
If you know in advance that the address space bounds of your heap are small, you do
not have to redefine
__user_heap_extent()
, but it does speed up the heap algorithms if
you do.
The input parameters are the default values that are used if this routine is not defined.
You can, for example, leave the default base value unchanged and only adjust the size.
Note
The size field returned must be a power of two. If you return zero for
size
, the heap
extent is set to 4GB.
Using a heap implementation from bare machine C
To use a heap implementation in an application that does not define
main()
and does not
initialize the C library:
1. Call
_init_alloc(base, top)
to define the base and top of the memory you want
to manage as a heap.
2. Define the function
unsigned __rt_heap_extend(unsigned size, void ** block)
to handle calls to extend the heap when it becomes full.
alloca()
alloca()
behaves identically to
malloc()
except that
alloca()
has automatic garbage
collection (see alloca() on page 4-101).