什么是堆类型对象 [英] What is Type Object in Heap

查看:238
本文介绍了什么是堆类型对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,当物体在堆的创建,他们也有额外的两个字段:

I know that when objects are created in Heap, they also have extra two more fields:

  1. 同步块索引
  2. 类型的对象指针

所以我不知道,当类型对象在堆内存中创建并拥有什么样的数据?它仅重presents类型的元数据?

So I wonder when Type Object is created in Heap memory and what kind of data it holds? It only represents the metadata of the Type?

我一直没能找到太多的细节有关。

I haven't been able to find much detail about that.

推荐答案

该类型的对象还包含备份任何静态字段的类型,以及一个方法表,每个中的类型定义的方法一个条目的字节数。

The Type object also contains the bytes that back any static fields on the type as well as a method table with one entry per method defined within the type.

如果该方法已被执行至少一次的方法表指向JIT编译的原生code每个条目。

Each entry in the method table points to JIT-compiled native code if the method has been executed at least once.

类型对象被创建的第一次的类型实例化或第一次的静态型部件被引用。

The type object is created the first time the type is instantiated or the first time a static type member is referenced.

我强烈建议购买杰弗里里希特的书的副本, CLR通过C#如果你要得到一个什么样的CLR做了非常深的了解。标题为第4章在运行时如何事情相关的部分涵盖了详细堆中的.NET类型分配过程。

I highly recommend buying a copy of Jeffrey Richter's book, CLR via C# if you want to get a really deep understanding of what the CLR does. The section titled "How Things Relate at Runtime" in chapter 4 covers the .NET type allocation process on the heap in detail.

有一些很好的信息,以及这个MSDN杂志文章,专在类型基础和的方法表

This MSDN Magazine article has some good information as well, specifically the sections on Type Fundamentals and MethodTable.

这篇关于什么是堆类型对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆