bsdmalloc - memory allocator
cc [ flag ... ] file ... –lbsdmalloc [ library ... ]
#include <stdlib.h> void *malloc(size_t size);
void *calloc(size_t nelem, size_t elsize);
void *memalign(size_t alignment, size_t size);
void *realloc(void *ptr, size_t size);
void *valloc(size_t size);
size_t malloc_usable_size(void *ptr);
void free(void *ptr);
These routines provide a general-purpose memory allocation package. They maintain a table of free blocks for efficient allocation and coalescing of free storage. When there is no suitable space already free, the allocation routines call sbrk(2) to get more memory from the system. Each of the allocation routines returns a pointer to space suitably aligned for storage of any type of object. Each returns a null pointer if the request cannot be completed.
They operate as described on the malloc(3C) manual page, except for the following differences:
For historical backward compatibility, realloc() accepts a pointer to a block freed since the most recent call to one of the allocation functions.
Support for using adi(7) is not available.
Entry points for memalign() and valloc() are empty routines that return failure, and are provided only to protect the user from mixing malloc() functions from different implementations. This will also cause calls to aligned_alloc(3C) and posix_memalign(3C) to fail.
Using realloc() with a block freed before the most recent call to malloc(), calloc(), or realloc() results in an error.
See malloc(3C) for an overview and comparison of all the allocation libraries provided by Oracle Solaris.
See attributes(7) for descriptions of the following attributes:
Use of libbsdmalloc renders an application non-SCD compliant.
The libbsdmalloc routines must not be mixed with other malloc implementations within a single process. Such use is undefined and may cause corruption or other failure.