// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; namespace IA11Hack { public struct Data { public int w; public int v0; public int v1; public int v2; } public class Program { private const int K = 10000000; public static void Main(string[] args) { long m1 = GC.GetTotalMemory(true); Data[] o = new Data[K]; for (int i = 0; i < K; i++) { o[i].w = i; o[i].v0 = i; o[i].v1 = i + 1; o[i].v2 = i + 2; } long m2 = GC.GetTotalMemory(true); Console.WriteLine("{0} {1}", o[0].v0, o[K - 1].v2); Console.WriteLine("{0}", (m2 - m1) / K); } } }