#include <sys/types.h>
Go to the source code of this file.
Defines | |
#define | _ABLE_CLIB_MALLOC_H 1 |
Functions | |
void * | calloc (size_t nmemb, size_t size) |
Allocate a memory area with contents are cleared to zero. | |
void * | malloc (size_t size) |
Allocate a memory area with indeterminate contents. | |
void * | realloc (void *ptr, size_t size) |
Change the size of a memory allocation. | |
void | free (void *ptr) |
Free a previous allocation. |
#define _ABLE_CLIB_MALLOC_H 1 |
Allocate a memory area with contents are cleared to zero.
Allocate memory area of a size determined by multiplying the nmemb elements by the element size. The memory is set to zero.
nmemb | The number of elemnets to allocate. | |
size | The size of each element. |
void free | ( | void * | ptr | ) |
void* malloc | ( | size_t | size | ) |
Allocate a memory area with indeterminate contents.
Allocate memory area of a given size. The memory contents are unspecified.
size | The size of the area to allocate. |
void* realloc | ( | void * | ptr, | |
size_t | size | |||
) |
Change the size of a memory allocation.
Alters the size of a memory allocation. The contents will be unchanged limited to the minimum of the old and new sizes. Newly allocated memory will be uninitialized in the same way as when using malloc.
The returned pointer must be used as the memory allocation may by moved by this operation. If the returned pointer is NULL the original area is left intact and not freed.
Using a size of zero is equivalent to calling free on the area and the returned pointer will be NULL.
The ptr passed must have been returned from a previous call to calloc, malloc or realloc. Using a ptr of NULL is permitted and is the same as calling malloc.
ptr | The pointer to the previous allocation or NULL for a new allocation. | |
size | The new size of allocation desired. |