Why do threads share the heap space?

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

    Because otherwise they would be processes. That is the whole idea of threads, to share memory.

提交回复
热议问题