// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; namespace IA11 { public struct Data { public int w; public int[] v; } 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].v = new int[3]; o[i].w = i; o[i].v[0] = i; o[i].v[1] = i + 1; o[i].v[2] = i + 2; } long m2 = GC.GetTotalMemory(true); Console.WriteLine("{0} {1}", o[0].v[0], o[K - 1].v[2]); Console.WriteLine("{0}", (m2 - m1) / K); } } }