Why do threads share the heap space?

前端 未结 8 790
时光取名叫无心
时光取名叫无心 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:13

    That's because the idea of threads is "share everything". Of course, there are some things you cannot share, like processor context and stack, but everything else is shared.

提交回复
热议问题