问题描述
我了解在Linux中, mm_struct
描述了进程的内存布局.我也理解 start_brk
和 brk
分别标记了进程堆部分的开始和结束.
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 start and end of the heap section of a process respectively.
现在,这是我的问题:我有一个过程为我编写了源代码,该过程使用 malloc
分配了5.25 GB的堆内存.但是,当我使用内核模块检查进程的 mm_sruct
时,我发现的值等于135168.这与我的预期不同:我期望的是 brk-start_brk
略高于5.25 GB.
Now, this is my problem: I have a process, for which I wrote the source code, that allocates 5.25 GB of heap memory using malloc
. However, when I examine the process's mm_sruct
using a kernel module I find the value of is equal to 135168. And this is different from what I expected: I expected brk - start_brk
to be equal slight above 5.25 GB.
那么,这是怎么回事?
谢谢.
推荐答案
我在中注意到以下内容 malloc(3)
的联机帮助页:
I notice the following in the manpage for malloc(3)
:
所以听起来好像使用了 mmap
而不是堆.
So it sounds like mmap
is used instead of the heap.
这篇关于堆在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!