Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 725247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:18:55+00:00 2026-05-14T06:18:55+00:00

It’s my understanding that all .NET object instances begin with an 8 byte ‘object

  • 0

It’s my understanding that all .NET object instances begin with an 8 byte ‘object header’: a synch block (4 byte pointer into a SynchTableEntry table), and a type handle (4 byte pointer into the types method table).

I’m not seeing this in VS 2010 RC’s (CLR 4.0) debugger memory windows.

Here’s a simple class that will generate a 16 byte instance, less 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;
    }
}

An SOS object dump tells me that the total object size is 24 bytes. That 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

Here’s the raw memory:

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

And here are some annotations:

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

My object begins a address 0x0205B660. But I can only account for 20 bytes of it, the type handle and the instance fields. There is no sign of a synch block pointer. The object size is reported as 24 bytes, but the debugger is showing that it only occupies 20 bytes of memory.

I’m reading Drill Into .NET Framework Internals to See How the CLR Creates Runtime Objects, and expected the first 4 bytes of my object to be a zeroed synch block pointer, as shown in Figure 8 of that article. Granted, this is an article about CLR 1.1.

I’m just wondering if the difference between what I’m seeing and what this early article reports is a change in either the debugger’s display of object layout, or in the way the CLR lays out objects in versions later than 1.1.

Anyway, can anyone account for my 4 missing bytes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:18:56+00:00Added an answer on May 14, 2026 at 6:18 am

    I believe the sync block is “behind” the object pointer in memory. That way a reference variable points directly to the method table. So, for your object at address 0x0205B660, the sync block would be at address 0x0205B65C.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 366k
  • Answers 366k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer To my knowledge, there are no standards for passing structured… May 14, 2026 at 4:33 pm
  • Editorial Team
    Editorial Team added an answer I have the same problem. I use completely different color… May 14, 2026 at 4:32 pm
  • Editorial Team
    Editorial Team added an answer Inline the calls to lengthsq(). Change pow(r2,-1.5) to 1/(r2*sqrt(r2)) to… May 14, 2026 at 4:32 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.