Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET: What is the object header used for?

Tags:

.net

In .NET there are 8 bytes of overhead for each object. 4 bytes are a pointer to the object's type. What are the other 4 bytes, known as the object header, used for?

Note: the question was asked in 2010 and is 32 bit specific. The overhead is bitness dependent: 1 pointer-size for the "object's type" (method table) and 1 pointer-size for the object header. So, that's 2*4 bytes for 32 bit and 2*8 bytes for 64 bit applications.

like image 788
Jonathan Allen Avatar asked Mar 24 '10 07:03

Jonathan Allen


People also ask

What is an object header?

The object header is the topmost area in the object's detail page that provides a detailed glimpse of that object.

What do headers do in C#?

Header objects are used to convey information about a remote function call (for example, transaction ID or a method signature).


1 Answers

This article discusses a lot of internals, including what goes into each object instance. Basically, it's the type information and a syncblock pointer (because ever object can potentially be locked upon)

like image 98
Damien_The_Unbeliever Avatar answered Oct 09 '22 06:10

Damien_The_Unbeliever