What is the header of an array in .NET
Posted
by Thomas
on Stack Overflow
See other posts from Stack Overflow
or by Thomas
Published on 2010-03-25T14:20:04Z
Indexed on
2010/03/25
14:23 UTC
Read the original article
Hit count: 357
Hi all,
I have a little bit seen the representation of an array in memory with Windbg and SOS plugin.
Here it is the c# :
class myobj{
public int[] arr;
}
class Program{
static void Main(string[] args){
myobj o = new myobj();
o.arr = new int[7];
o.arr[0] = 0xFFFFFF;
o.arr[1] = 0xFFFFFF;
o.arr[2] = 0xFFFFFF;
o.arr[3] = 0xFFFFFF;
o.arr[4] = 0xFFFFFF;
}
}
I break at final of Main, and I observ :
0:000> !clrstack -l
OS Thread Id: 0xc3c (0)
ESP EIP
0015f0cc 0043d1cf test.Program.Main(System.String[])
LOCALS:
0x0015f0d8 = 0x018a2f58
0:000> !do 0x018a2f58
Name: test.myobj
MethodTable: 0026309c
EEClass: 00261380
Size: 12(0xc) bytes
(C:\Users\admin\Documents\Visual Studio 2008\Projects\test\test\bin\Debug\test.exe)
Fields:
MT Field Offset Type VT Attr Value Name
01324530 4000001 4 System.Int32[] 0 instance 018a2f64 tab
0:000> dd 018a2f64
018a2f64 01324530 00000007 00ffffff 00ffffff
018a2f74 00ffffff 00ffffff 00ffffff 00000000
018a2f84 00000000 00000000 00000000 00000000
018a2f94 00000000 00000000 00000000 00000000
018a2fa4 00000000 00000000 00000000 00000000
018a2fb4 00000000 00000000 00000000 00000000
018a2fc4 00000000 00000000 00000000 00000000
018a2fd4 00000000 00000000 00000000 00000000
I can see that the header contains the size of the array (00000007) but my question is : what is the value 01324530 ?
Thanks !
© Stack Overflow or respective owner