What does the “new ” keyword in .net actually do?

前端 未结 2 1605
没有蜡笔的小新
没有蜡笔的小新 2021-02-14 10:47

I know that the new keyword is calling the class constructor but at which stage do we allocate memory for the class?

In my understanding it should correspon

2条回答
  •  滥情空心
    2021-02-14 11:21

    Everything for object creation is hidden behind the newobj opcode (or initobj for value-types). As such, it is entirely an implementation detail how and where memory is allocated, and how that ties into other memory management structures.

提交回复
热议问题