Where is the heap?

前端 未结 1 1736
一生所求
一生所求 2021-01-27 11:41

I understand that in Linux the mm_struct describes the memory layout of a process. I also understand that the start_brk and brk mark the s

相关标签:
1条回答
  • 2021-01-27 12:09

    I notice the following in the manpage for malloc(3):

    Normally, malloc() allocates memory from the heap, and adjusts the size of the heap as required, using sbrk(2). When allocating blocks of memory larger than MMAP_THRESHOLD bytes, the glibc malloc() implementation allocates the memory as a private anonymous mapping using mmap(2). MMAP_THRESHOLD is 128 kB by default, but is adjustable using mallopt(3). Allocations performed using mmap(2) are unaffected by the RLIMIT_DATA resource limit (see getrlimit(2)).

    So it sounds like mmap is used instead of the heap.

    0 讨论(0)
提交回复
热议问题