我正在使用SOS調試擴展dll檢查字符串類型的內存佈局。結果如下。.NET在哪裏放置String值?
!DSO
ESP/REG Object Name
0015EFC0 01c6b9cc System.String hello,world
!做01c6b9cc
Name: System.String
MethodTable: 6de3f9ac
EEClass: 6db78bb0
Size: 36(0x24) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089>\mscorlib.dll
String: hello,world
Fields:
MT Field Offset Type VT Attr Value Name
6de42978 40000ed 4 System.Int32 1 instance 11 m_stringLength
6de41dc8 40000ee 8 System.Char 1 instance 68 m_firstChar
6de3f9ac 40000ef 8 System.String 0 shared static Empty
>> Domain:Value 00331488:01c61228 <<
現在我想知道,究竟哪裏是字符串值 「Hello World」 的存儲?
謝謝。
我猜可能是一個'char []'在堆上的其他地方。 – Joey 2011-03-09 03:36:55