Heap versus Stack allocation implications (.NET)

前端 未结 7 1379
梦如初夏
梦如初夏 2020-12-02 16:03

From an SO answer1 about Heap and Stack, it raised me a question: Why it is important to know where the variables are allocated?

At anoth

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 16:35

    In my opinion knowing about the differences between the stack and heap and how things are allocated on it can be very helpful when you really start thinking about performance of your application. The following questions make it essential to understand the differences: What do you think is faster and more efficient for .NET to access? - Stack or Heap. In what scenarios .NET may place a value type of the heap?

提交回复
热议问题