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

前端 未结 6 893
無奈伤痛
無奈伤痛 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:48

    On Windows, the pages are committed (that is, the free memory available goes down), but they will not actually be allocated until you touch the pages (either read or write).

提交回复
热议问题