Keil Logo

__rt_heap_extend()

4.27 __rt_heap_extend()

Defined in rt_heap.h, the __rt_heap_extend() function returns a new eight-byte aligned block of memory to add to the heap, if possible.

If you reimplement __rt_stackheap_init(), you must reimplement this function. An incomplete prototype implementation is in rt_memory.s.
This function is not part of the C library standard, but the ARM® C library supports it as an extension.

Syntax

extern unsigned __rt_heap_extend(unsigned size, void **block);

Usage

The calling convention is ordinary AAPCS. 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 must be 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 eight-byte boundary.
  • Size is measured in bytes.
  • The function is subject only to ARM Architecture Procedure Call Standard (AAPCS) constraints.

Returns

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. 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.
Non-ConfidentialPDF file icon PDF versionARM DUI0378H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.