Do different programs gets their memory from a common heap or from a separate heap?

后端 未结 3 1996
悲哀的现实
悲哀的现实 2021-02-15 03:23

I am a bit confused how glibc on linux allocates its memory to various program.These are the few questions:

  1. Is it been allocated from a common heap(i.e is there

3条回答
  •  既然无缘
    2021-02-15 03:48

    1. There is no common heap in the libc sense - this would violate process protection and virtual memory rules. Each process maintains its own heap. The kernel (with the help of the MMU in the processor) maintains the virtual memory tables which map virtual addresses to real memory.

    2. Static libraries are nothing more than linking code at compile time - there is no run time concept of a static library. It is one and the same as the process, and will use its heap.

提交回复
热议问题