I did some tests and was very surprised ... x64 compile mode. The first test showed 4 bytes, everything is fine here. Second 32. Wow, I thought. And treyty 32 WTF ???
static int count = 10000000; static void Array_C() { var size = GC.GetTotalMemory(true); var arr = new int[count]; for (var i = 0; i < count; ++i) { arr[i] = i; } var mem = GC.GetTotalMemory(true) - size; Console.WriteLine("Выделено памяти: " + mem + ", размер одного объекта: " + Math.Truncate((double)mem / count) + ", код последней " + arr.Last()); } static void Array_E() { var size = GC.GetTotalMemory(true); var arr = new object[count]; for (var i = 0; i < count; ++i) { arr[i] = new object(); } var mem = GC.GetTotalMemory(true) - size; Console.WriteLine("Выделено памяти: " + mem + ", размер одного объекта: " + Math.Truncate((double)mem / count) + ", код последней " + arr.Last().GetHashCode()); } static void Array_F() { var size = GC.GetTotalMemory(true); var arr = new C[count]; for (var i = 0; i < count; ++i) { arr[i] = new C { Val0 = i, Val1 = i }; } var mem = GC.GetTotalMemory(false) - size; Console.WriteLine("Выделено памяти: " + mem + ", размер одного объекта: " + Math.Truncate((double)mem / count) + ", код последней " + arr.Last().Val0 + arr.Last().Val1); } [StructLayout(LayoutKind.Sequential, Pack = 1)] class C { public int Val0; public int Val1; } The question is not even why in the second test one instance takes 32 bytes. And that is why in the third test the instance does not occupy 40 bytes.