Go to main content

man pages section 3: Basic Library Functions

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

mapmalloc(3MALLOC)

Name

mapmalloc - memory allocator

Synopsis

cc [ flag ... ] file ... –lmapmalloc [ library ... ]

#include <stdlib.h>

void *malloc(size_t size);
void *calloc(size_t nelem, size_t elsize);
void *realloc(void *ptr, size_t size);
size_t malloc_usable_size(void *ptr);
void free(void *ptr);

Description

The collection of malloc functions in this library use mmap(2) instead of sbrk(2) for acquiring new heap space. The functions in this library are intended to be used only if necessary, when applications must call sbrk(), but need to call other library routines that might call malloc. The algorithms used by these functions are not sophisticated. There is no reclaiming of memory.

They operate as described on the malloc(3C) manual page, except for the following differences:

  • Space for the memory arena is obtained via mmap(2) instead of sbrk(2).

  • 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.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
MT-Level
Safe

Usage

See malloc(3C) for an overview and comparison of all the allocation libraries provided by Oracle Solaris.

See Also

brk(2), mmap(2), malloc(3C), libmapmalloc(3LIB), attributes(7)