Code for malloc and free

The POSIX interface of malloc is defined here.

If you want to find out how the C library in GNU/Linux (glibc) implements malloc, go and get the source code from http://ftp.gnu.org/gnu/glibc/ or browse the git repository and look at the malloc/malloc.c file.

There is also the base documentation of the Memory Allocator by Doug Lea that describes the theory of a m(emory)alloc(ator) (read this carrefully, and then decide if you really need to implement your own malloc).

Leave a Comment