pmalloc(3)

NAME
pmalloc, pcalloc, prealloc - allocate memory in a pool

SYNOPSIS
#include <pool.h>

void *pmalloc (pool, size_t n);
void *pcalloc (pool, size_t nmemb, size_t size);
void *prealloc (pool, void *ptr, size_t n);

DESCRIPTION

Allocate memory in a pool or, if pool is null, on the main heap (equivalent to plain malloc). If memory is allocated in a real pool, then it is automatically freed when the pool is deleted.

Memory returned is word-aligned.

If a memory allocation fails, the bad_malloc_handler function is called (which defaults to just calling abort(3)).

pcalloc is identical to pmalloc but also sets the memory to zero before returning it.

prealloc increases the size of an existing memory allocation. prealloc might move the memory in the process of reallocating it.

BUGS
prealloc cannot reduce the size of an existing memory allocation.

AUTHOR
Richard Jones <rich@annexia.org>

LICENSE
GNU LGPL (see http://www.gnu.org/)

VERSION
c2lib-1.2.14