ObjectLayoutInspector
ObjectLayoutInspector copied to clipboard
Probably wrong layout for System.Object
ObjectLayoutInspector.TypeLayout.PrintLayout<object>();
Prints:
Type layout for 'Object'
Size: 8 bytes. Paddings: 0 bytes (%0 of empty space)
|============================|
| Object Header (8 bytes) |
|----------------------------|
| Method Table Ptr (8 bytes) |
|============================|
|============================|
However, empty classes occupy IntPtr.Size bytes (ObjectLayoutInspector.TypeInspector.GetSizeOfReferenceTypeInstance(typeof(object)) returns 8 on 64-bit OS).
AFAIK it does not count the header and method table ptr. And you get the 8 from the addiitional invisible padding.
To count all use FullSize.