内存布局之:最小的内存图谱

来源:互联网 发布:nginx限制上传目录 编辑:程序博客网 时间:2024/04/28 03:06

@stack
OS Thread Id: 0xb54 (2900)
0013f218 00be16f4 System.Object

00be16f4
Name: System.Object
MethodTable: 02e1d0f0
EEClass: 02e1d08c
Size: 12(0xc) bytes

@02e1d0f0
EEClass: 02e1d08c
Module: 02de2000
Name: System.Object
mdToken: 02000002
BaseSize: 0xc
ComponentSize: 0x0
Number of IFaces in IFaceMap: 0
Slots in VTable: 14
--------------------------------------
MethodDesc Table
  Entry MethodDesc      JIT Name
03091278  02e6b928  PreJIT ToString()
0308b3b0  02e6b930  PreJIT Equals(System.Object)
0308b3d0  02e6b948  PreJIT GetHashCode()
030824d0  02e6b950  PreJIT Finalize()
030824b8  02e6b920  PreJIT .ctor()
79ef257a  02e6b8f0    FCALL InternalEquals(System.Object, System.Object)
03095b70  02e6b938  PreJIT Equals(System.Object, System.Object)
03095b94  02e6b940  PreJIT ReferenceEquals(System.Object, System.Object)
79e80171  02e6b8f8    FCALL InternalGetHashCode(System.Object)
033e1604  02e6b900    FCALL GetType()
033e1618  02e6b908    FCALL MemberwiseClone()
033e162c  02e6b958  PreJIT FieldSetter(System.String, System.String, System.Object)
033e1640  02e6b960  PreJIT FieldGetter(System.String, System.String, System.Object ByRef)
033e1654  02e6b968  PreJIT GetFieldInfo(System.String, System.String)

@02e1d08c
Class Name: System.Object
mdToken: 02000002
Parent Class: 00000000
Module: 02de2000
Method Table: 02e1d0f0
Vtable Slots: 4
Total Method Slots: e
Class Attributes: 102001 
NumInstanceFields: 0
NumStaticFields: 0

 

Size: 12(0xc) bytes
MethodTable: 02e1d0f0
EEClass: 02e1d08c
Module: 02de2000

0x02E1D0F0  00 00 04 02  ....
0x02E1D0F4  0c 00 00 00  ....
0x02E1D0F8  22 04 0e 00  "...
0x02E1D0FC  04 00 00 00  ....
0x02E1D100  00 00 00 00  ....
0x02E1D104  00 20 de 02  . ..
0x02E1D108  54 47 de 02  TG..
0x02E1D10C  8c d0 e1 02  ....
0x02E1D110  00 00 00 00  ....
0x02E1D114  00 00 00 00  ....
0x02E1D118  78 12 09 03  x...
0x02E1D11C  b0 b3 08 03  ....
0x02E1D120  d0 b3 08 03  ....
0x02E1D124  d0 24 08 03  .$..
0x02E1D128  b8 24 08 03  .$..
0x02E1D12C  7a 25 ef 79  z%.y
0x02E1D130  70 5b 09 03  p[..
0x02E1D134  94 5b 09 03  .[..
0x02E1D138  71 01 e8 79  q..y
0x02E1D13C  04 16 3e 03  ..>.
0x02E1D140  18 16 3e 03  ..>.
0x02E1D144  2c 16 3e 03  ,.>.
0x02E1D148  40 16 3e 03  @.>.
0x02E1D14C  54 16 3e 03  T.>.
0x02E1D150  74 f1 f6 02  t...
0x02E1D154  00 00 00 00  ....
0x02E1D158  00 20 de 02  . ..
0x02E1D15C  06 00 00 02  ....
0x02E1D160  b8 d1 e1 02  ....
0x02E1D164  ff ff 04 00  ....
0x02E1D168  12 00 00 00  ....
0x02E1D16C  00 00 00 00  ....
0x02E1D170  00 00 00 00  ....
0x02E1D174  00 00 00 00  ....
0x02E1D178  ff ff ff ff  ....
0x02E1D17C  ff ff ff ff  ....

 

MethodTable Layout

 

CGInfo
Flags
Basic Instance Size
EEClass
Interface Vtable Map
Num Interfaces
CoreElementType
Module
.cctor Slot
Default .ctor Slot
Interface Map
Delegate
Mum Method Solts

 


CLR执行托管代码的第一行代码前
[1]系统域
系统域负责创建和初始化共享域和默认应用程序域。
它将系统库mscorlib.dll载入共享域,
并且维护进程范围内部使用的隐含或者显式字符串符号。

[2]共享域
所有不属于任何特定域的代码被加载到系统库SharedDomain.Mscorlib,
对于所有应用程序域的用户代码都是必需的。
它会被自动加载到共享域中。

[3]默认程序域
默认域是应用程序域(AppDomain)的一个实例,一般的应用程序代码在其中运行。

[4]默认程序域加载,四个堆/Heap
a)进程/Process堆:
b)JIT堆:存放编译后代码的地方
c)GC堆:存放小对象
d)LOH/Large Object堆:存放大对象

而GC和LOH是存放对象的地方。
对象和各自的方法是通过方法表(Method Tables)连接起来的。

[1]变量
保存在线程堆上

[2]引用对象
保存在堆上
对象都有额外的两个字段
a)同步索引块
b)类型对象指针

而GC和LOH是存放对象的地方。
对象和各自的方法是通过方法表(Method Tables)连接起来的。

原创粉丝点击