Take the tour ×  I have understanding how heap and garbage
collector works: garbage collection happens in generations,
memory allocation happens sequentially, during garbage
collection free/unused space compacted by shifting data and
forming continues block, etc.  Is there any headers for
allocated memory chunks are present and how big are they (I
heard it’s 8-16 bytes for .NET CLR) and if byte, word or quad-
word alignment present? I’m interested in any information for
JIT (Java) and CLR (.NET Framework or Mono) implementation for
x86 and x64 processor architectures.  share|improve this
question add comment  3 Answers  up vote 4 down vote accepted  I
believe the header size is two words - one for the type
reference and one for the sync block and other flags. The
padding is (I believe) just enough to round the total size up to
a whole number of words.  For instance, a reference type with
just an "int" in takes 12 bytes on x86, as demonstrated here:
using System;  public class Foo     int x;      public Foo(in