## NAME

malloc, free - memory allocator

## SYNOPSIS

#include <stdlib.h>

void *malloc(size_t size );
void free(void *ptr );

## DESCRIPTION

malloc() and free() provide a simple general-purpose memory allocation package. malloc() returns a pointer to a block of at least size bytes.

The argument to free() is a pointer to a block previously allocated by malloc(). After free() is performed this space is made available for further allocation. If ptr is a NULL pointer, no action occurs.

Undefined results will occur if the space assigned by malloc() is overrun or if some random number is handed to free() .

malloc() will fail if there is not enough available memory.

There is interesting things that can be done underneath the facade of malloc() and free() to improve the system performance. The memory pools and partitions can be used along with kalloc() to generate the necessary optimizations to better utilize fast memory and to move certain constants and structures into FLASH.

## RETURN VALUES

malloc() will return a NULL pointer if there is no available memory; otherwise, it returns a pointer to a memory area of at least size bytes.

#### Home page (Kernel)

## < Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2018 >