//[Test] public void GetLayoutsForAllTypes() { //var xx = new SizeComputer<RSAOAEPKeyExchangeDeformatter>(); var cache = TypeLayoutCache.Create(); var layouts = GetAllLoadedTypes() //.Where(t => t.Assembly.FullName.Contains("mscorlib")) .Select(t => TypeLayout.TryGetLayout(t, cache)) .Where(t => t != null) .Select(t => t.Value) .ToList(); var top10BiggestInstances = layouts.OrderByDescending(l => l.Size).Take(20); var top10WithBiggestPaddings = layouts.OrderByDescending(l => l.Paddings).Take(20); Console.WriteLine("Top 10 biggest types:"); foreach (var t in top10BiggestInstances) { Console.WriteLine(t); } Console.WriteLine(); Console.WriteLine("Top 10 types with biggest paddings:"); foreach (var t in top10WithBiggestPaddings) { Console.WriteLine(t); } }