// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; namespace E { public class Big { private byte[] b; public Big() { Console.WriteLine("Allocating 10 MB"); b = new byte[10000000]; } ~Big() { Console.WriteLine("Soon to free 10 MB"); } } public class Program { public static void F() { List lst = new List(); lst.Add(new Big()); lst.Add(new Big()); lst.Add(new Big()); lst.Add(new Big()); lst.Add(new Big()); } public static void Main(string[] args) { for(int i = 0; i < 50; i++) { F(); } } } }