Do not see synchronization block in object layout

I understand that all instances of a .NET object begin with an 8-byte object header: a synchronization block (4 byte pointer in the SynchTableEntry table) and a type descriptor (4 byte pointer to the type method table).

I do not see this in the memory windows of the VS 2010 RC debugger (CLR 4.0).

Here is a simple class that will generate a 16-byte instance, with the exception of the object header.

class Program
{
    short myInt = 2;    // 4 bytes
    long myLong = 3;    // 8 bytes
    string myString = "aString"; // 4 byte object reference

    // 16 byte instance

    static void Main(string[] args)
    {
        new Program();
        return;
    }
}

The dump of the SOS object tells me that the total size of the object is 24 bytes. It makes sense. My 16-byte instance plus an 8-byte object header.

! DumpObj 0205b660
Name: Offset_Test.Program
MethodTable: 000d383c
EEClass: 000d13f8
Size: 24 (0x18) bytes
File: C: \ Users \ Bob \ Desktop \ Offset_Test \ Offset_Test \ bin \ Debug \ Offset_Test.exe
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
632020fc  4000001       10         System.Int16  1 instance        2 myInt
632050d8  4000002        4         System.Int64  1 instance        3 myLong
631fd2b8  4000003        c         System.String  0 instance 0205b678 myString

:

0x0205B660  000d383c 00000003 00000000 0205b678 00000002 ...

:

offset  0 000d383c   ;TypeHandle (pointer to MethodTable), 4 bytes
offset  4 00000003 00000000  ;myLong, 8 bytes
offset 12 0205b678   ;myString, 4 byte reference to address of "myString" on GC Heap
offset 16 00000002  ;myInt, 4 bytes

0x0205B660. 20 , . . 24 , , 20 .

Drill Into.NET Framework Internals, , CLR , 4 , 8 . , CLR 1.1.

, , , , , , CLR 1.1.

, - 4 ?

+5
1

, "" . , . , 0x0205B660 0x0205B65C.

+8

All Articles