Why do threads share the heap space?

前端 未结 8 736
时光取名叫无心
时光取名叫无心 2020-12-23 10:12

Threads each have their own stack, but they share a common heap.

Its clear to everyone that stack is for local/method variables & heap is for instance/class vari

8条回答
  •  自闭症患者
    2020-12-23 11:00

    Processes don't --generally-- share heap space. There are API's to permit this, but the default is that processes are separate

    Threads share heap space.

    That's the "practical idea" -- two ways to use memory -- shared and not shared.

提交回复
热议问题