Linux heap allocation

In a FreeRTOSheap - it's just a global array with a size (allows a call heapSize) defined in a file Hthat the user can change. This array is an uninitialized global array, which makes it part of the BSSimage section , since it is filled with zeros at boot, then each memory allocation is taken from this array and each address of the allocated memory is the offset of this array.

Thus, to maximize the use of memory size, we can approach the size of the areas Data, Textand BSSour entire program, and determine the heap size approximately as heapSize = RAM_size - Text_size - Data_size - BSS_size.

I would like to know what is the equivalent Linux implementation. Can Linux scan this RAM and determine its size at runtime? does linux have an equivalent data structure for heap management? if so, how does it allocate memory for this data structure in the first place?

+4
source share
2 answers

I would like to know that the equivalent implementation is Linux.

Read “Chapter 8: Memory Allocation” in Linux Device Drivers, Third Edition .

0
source

Linux , , . , , .

, , " ", " ".

0

Source: https://habr.com/ru/post/1676554/


All Articles