Memory manager
A memory manager is a part of a computer program which accepts requests from the program to allocate and deallocate chunks of memory.
The objective of the memory manager is generally to allow dynamic memory allocation. For example, in the C programming language, without use of a memory allocation library, memory can only be allocated statically and on the stack, while the use of a memory manager allows for dynamic allocation on the heap. A memory manager can also make allocation and deallocation more efficient, group allocated blocks according to particular conditions, and even collect statistics, and trace memory access violations.
The interface to the memory manager is a set of functions which are used by the program to allocate and release memory. In C, the memory manager is primarily accessed through malloc
and free
; there are some additional functions, such as realloc
and calloc
that are closely related to malloc
. In C++ there are 12 global constructs for managing memory: new
, new[]
, delete
, delete[]
, new(nothrow)
, new(nothrow)[]
, delete(nothrow)
, delete(nothrow)[]
, malloc
, calloc
, realloc
, and free
.