Does malloc lazily create the backing pages for an allocation on Linux (and other platforms)?

前端 未结 6 898
無奈伤痛
無奈伤痛 2020-11-27 10:20

On Linux if I were to malloc(1024 * 1024 * 1024), what does malloc actually do?

I\'m sure it assigns a virtual address to the allocation (by walking the

6条回答
  •  庸人自扰
    2020-11-27 10:29

    On most Unix-like systems, it manages the brk boundary. The VM adds pages when hit by the processor. At least Linux and BSDs do this.

提交回复
热议问题