malloc returns memory or virtual address space

前端 未结 15 1817
攒了一身酷
攒了一身酷 2021-01-31 06:36

Does malloc allocate a block of memory on the heap or should it be called Virtual Address Space?

Am I being picky calling it Virtual Address Space or this just the legac

15条回答
  •  醉话见心
    2021-01-31 07:26

    malloc allocates a block on the heap. For each memory page that the allocated block spans, there may or may not be physical memory committed to it at the outset. The entire block is usable though, since the OS will take care of handling page faults and managing physical/virtual memory that's needed to support the allocation.

提交回复
热议问题