malloc returns memory or virtual address space

前端 未结 15 1837
攒了一身酷
攒了一身酷 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:10

    Does malloc allocate a block of memory on the heap or should it be called virtual adress space?

    short answer: malloc allocates memory on the heap.

    it's not precise enough to say that malloc allocates memory in the virtual adress[sic] space, since your call stack itself is part of that same space.

提交回复
热议问题