Keil Logo

Memory Allocation Routines

Routine Attributes Description
calloc   Allocates storage for an array from the memory pool.
free   Frees a memory block that was allocated using calloc, malloc, or realloc.
init_mempool   Initializes the memory location and size of the memory pool.
malloc   Allocates a block from the memory pool.
realloc   Reallocates a block from the memory pool.

The memory allocation functions provide you with a means to specify, allocate, and free blocks of memory from a memory pool. Standard memory allocation functions are implemented as functions and are prototyped in the stdlib.h include file.

Before using any of these functions to allocate memory, you must first specify the size and location of the memory pool using the init_mempool routine.

The calloc and malloc routines allocate blocks of memory from the pool. The calloc routine allocates an array with a specified number of elements of a given size and initializes the array to 0. The malloc routine allocates a specified number of bytes.

The realloc routine changes the size of an allocated block. The free routine returns a previously allocated memory block to the memory pool.

  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.