4.9.10. __rt_heap_extend()

This function returns a new 8-byte aligned block of memory to add to the heap, if possible. If you reimplement the other memory model functions, you must reimplement this function. An incomplete prototype implementation is in rt_memory.s.


The calling convention is ordinary ATPCS. On entry, r0 is the minimum size of the block to add, and r1 holds a pointer to a location to store the base address.

The default implementation has the following characteristics:

  • The returned size is either:

    • a multiple of eight bytes of at least the requested size

    • 0, denoting that the request cannot be honored.

  • The returned base address is aligned on an 8-byte boundary.

  • Size is measured in bytes.

  • The function is subject only to ATPCS constraints.


The default implementation extends the heap if there is sufficient free heap memory. If it cannot, it calls __user_heap_extend() if it is implemented (see __user_heap_extend()). On exit, r0 is the size of the block acquired, or 0 if nothing could be obtained, and the memory location r1 pointed to on entry contains the base address of the block.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D