include/malloc.h File Reference

#include <sys/types.h>

Include dependency graph for malloc.h:

This graph shows which files directly or indirectly include this file:

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 Documentation

#define _ABLE_CLIB_MALLOC_H   1


Function Documentation

void* calloc ( size_t  nmemb,
size_t  size 
)

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.

Parameters:
nmemb The number of elemnets to allocate.
size The size of each element.
Returns:
The allocated memory or NULL if the allocation cannote be satisfied.

void free ( void *  ptr  ) 

Free a previous allocation.

Free an allocation previously made by calloc, malloc or realloc. The ptr may be NULL in which case no operation is performed.

Parameters:
ptr The previously allocated memory.

void* malloc ( size_t  size  ) 

Allocate a memory area with indeterminate contents.

Allocate memory area of a given size. The memory contents are unspecified.

Parameters:
size The size of the area to allocate.
Returns:
The allocated memory or NULL if the allocation cannote be satisfied.

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.

Parameters:
ptr The pointer to the previous allocation or NULL for a new allocation.
size The new size of allocation desired.
Returns:
The new allocation or NULL on error.


Generated on Tue Jan 20 14:28:55 2009 for ABLE LIBC by  doxygen 1.5.6