BSDMALLOC(3) Library Functions Manual BSDMALLOC(3)

bsdmalloclightweight historic BSD memory allocator replacement

library “libbsdmalloc”

#include <stdlib.h>

void *
malloc(size_t size);

void *
calloc(size_t nmemb, size_t size);

void *
realloc(void *ptr, size_t size);

void *
aligned_alloc(size_t alignment, size_t size);

int
posix_memalign(void **memptr, size_t alignment, size_t size);

void
free(void *ptr);

void
_malloc_prefork(void);

void
_malloc_postfork(void);

void
_malloc_postfork_child(void);

The bsdmalloc library provides a lower-performance but smaller-size drop-in replacement for the standard malloc(3) family of functions provided by Standard C Library (libc, -lc), as well as internal hooks for fork(2) safety in multithreaded programs.

Programs can be statically linked with -lbsdmalloc for smaller code footprint, at a higher cost to run-time performance and scalability and limited diagnostics.

malloc(3), posix_memalign(3)

bsdmalloc's implementation of malloc(), calloc(), and realloc() doesn't correctly set errno(2) on failure.

July 4, 2023 NetBSD 11.0