In this chapter, we will follow the steps below
- Introducing the macro operation of the heap we know well about dynamic memory allocation
- Describe the data structures used to achieve these operations
- Introduce the specific operations of using these data structures to achieve heap allocation and recycling
- Introduce the various utilization techniques of the heap from shallow to deep.
For different applications, due to the different memory requirements, there are many implementations of the heap, as follows:
dlmalloc – General purpose allocator ptmalloc2 – glibc jemalloc – FreeBSD and Firefox tcmalloc – Google libumem - Solaris
Here we mainly introduce the implementation of the heap in glibc. If there is time later, it will continue to introduce the implementation of other heaps and their utilization.
The main reference materials in this section are as follows. There are many contents in the text that will be consistent with the reference materials, and will not be explained in the future.
glibc source code
- For more references, please see the files in the ref directory.