On 21 November 2013 07:12, Karlsson, Magnus <magnus.karls...@lsi.com> wrote:
> Just wondering if somebody could point me to a good document on how the heap
> reclamation algorithm works for memory allocated in a user space program
> using the regular malloc/calloc functions.

Section 7.1.3, whose sub-sections include: "Implementation of malloc()
and free()", "Tools and libraries for malloc debugging", and
"Controlling and monitoring the malloc package", of Michael Kerrisk's
"The Linux Programming Interface" (http://man7.org/tlpi/index.html) is
one of the better reads of which I'm aware. He recommends reading the
man pages for malloc_info, malloc_stats, mallopt, and mallinfo (among
others) for more information.

In the C language, reclamation of allocated memory is usually driven
by the application. When you free() some memory, internal structures
know the size of what was previously allocated at the given location
(i.e. what was given to you by malloc()) and simply release that back
into the heap. There are ways to tweak the allocation of memory.

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to